Skip to content

fix: update changelog workflow #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/update-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: read
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
token: ${{ secrets.GITHUB_TOKEN }}

- name: Get PR title and body
id: pr-info
Expand Down Expand Up @@ -84,16 +85,19 @@ jobs:
git config --local user.name "github-actions[bot]"

# Create branch, commit and push
git checkout -b bot/update-changelog-v${NEW_VERSION}
BRANCH_NAME="bot/update-changelog-v${NEW_VERSION}"
git checkout -b "$BRANCH_NAME"
git add CHANGELOG.md
git commit -m "docs: update changelog for v${NEW_VERSION}"
git push origin bot/update-changelog-v${NEW_VERSION}

# Create PR
# Force push in case branch exists
git push -f origin "$BRANCH_NAME"

# Create PR using GitHub CLI
gh pr create \
--title "docs: update changelog for v${NEW_VERSION}" \
--body "Automated changelog update for version ${NEW_VERSION}" \
--base main \
--head bot/update-changelog-v${NEW_VERSION}
--head "$BRANCH_NAME" || true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}