You've already forked computing-box
Update .gitea/workflows/changelog.yml
All checks were successful
Changelog / changelog (push) Successful in 38s
All checks were successful
Changelog / changelog (push) Successful in 38s
This commit is contained in:
@@ -16,15 +16,20 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# Generates Keep a Changelog style CHANGELOG.md using git-cliff.
|
||||||
|
# IMPORTANT: The action downloads git-cliff from GitHub Releases, so we pass a GitHub PAT
|
||||||
|
# (stored as a Gitea secret) to avoid GitHub API 401/rate-limit issues.
|
||||||
- name: Generate CHANGELOG.md (Keep a Changelog)
|
- name: Generate CHANGELOG.md (Keep a Changelog)
|
||||||
uses: orhun/git-cliff-action@v4
|
uses: orhun/git-cliff-action@v4
|
||||||
with:
|
with:
|
||||||
config: cliff.toml
|
config: cliff.toml
|
||||||
args: --verbose
|
args: --verbose
|
||||||
|
github_token: ${{ secrets.DC_GITHUB_PAT }}
|
||||||
env:
|
env:
|
||||||
OUTPUT: CHANGELOG.md
|
OUTPUT: CHANGELOG.md
|
||||||
|
|
||||||
- name: Commit and push if changed (PAT)
|
# Commits and pushes CHANGELOG.md back to main using a Gitea PAT stored as CHANGELOG_PAT
|
||||||
|
- name: Commit and push if changed (Gitea PAT)
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CHANGELOG_PAT: ${{ secrets.CHANGELOG_PAT }}
|
CHANGELOG_PAT: ${{ secrets.CHANGELOG_PAT }}
|
||||||
@@ -42,18 +47,16 @@ jobs:
|
|||||||
git add CHANGELOG.md
|
git add CHANGELOG.md
|
||||||
git commit -m "docs(changelog): update changelog [skip ci]"
|
git commit -m "docs(changelog): update changelog [skip ci]"
|
||||||
|
|
||||||
# Push using PAT (avoid relying on built-in tokens)
|
|
||||||
# NOTE: This assumes your origin remote is already set by checkout.
|
|
||||||
origin_url="$(git remote get-url origin)"
|
origin_url="$(git remote get-url origin)"
|
||||||
|
|
||||||
# Convert SSH origin to HTTPS if needed
|
# Convert SSH origin to HTTPS if needed (git@host:owner/repo.git -> https://host/owner/repo.git)
|
||||||
if echo "$origin_url" | grep -q "^git@"; then
|
if echo "$origin_url" | grep -q "^git@"; then
|
||||||
host="$(echo "$origin_url" | sed -E 's#git@([^:]+):.*#\1#')"
|
host="$(echo "$origin_url" | sed -E 's#git@([^:]+):.*#\1#')"
|
||||||
path="$(echo "$origin_url" | sed -E 's#git@[^:]+:(.*)#\1#')"
|
path="$(echo "$origin_url" | sed -E 's#git@[^:]+:(.*)#\1#')"
|
||||||
origin_url="https://$host/$path"
|
origin_url="https://$host/$path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Inject token (PAT) into HTTPS URL
|
# Inject token into https:// URL (https://host/owner/repo.git -> https://oauth2:TOKEN@host/owner/repo.git)
|
||||||
authed_url="$(echo "$origin_url" | sed -E "s#^https://#https://oauth2:${CHANGELOG_PAT}@#")"
|
authed_url="$(echo "$origin_url" | sed -E "s#^https://#https://oauth2:${CHANGELOG_PAT}@#")"
|
||||||
|
|
||||||
git push "$authed_url" HEAD:main
|
git push "$authed_url" HEAD:main
|
||||||
|
|||||||
Reference in New Issue
Block a user