Skip to content

Commit

Permalink
ci: fix github action that creates changelog PR
Browse files Browse the repository at this point in the history
  • Loading branch information
Mcdostone committed Jan 8, 2025
1 parent 6c874ce commit dff41e2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:

changelog:
needs: [version, create-release]
name: Create changelog
runs-on: ubuntu-latest
steps:
- name: Check out repository
Expand All @@ -78,16 +79,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit changelog
run: |
git checkout -b "changelog/${{ needs.version.outputs.version }}"
git checkout -b "changelog/v${{ needs.version.outputs.version }}"
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add CHANGELOG.md
git commit -m "chore: Update changelog"
git push origin "changelog/${{ needs.version.outputs.version }}" --force
git push origin "changelog/v${{ needs.version.outputs.version }}" --force
- name: Create pull request for changelog
run: |
alreadyExists=$(gh pr list --json headRefName | jq '.[] | select(.headRefName == "dependabot/cargo/${{ needs.version.outputs.version }}") | any')
alreadyExists=$(gh pr list --json headRefName | jq '.[] | select(.headRefName == "changelog/v${{ needs.version.outputs.version }}") | any')
if [[ "$alreadyExists" == "" ]]; then
gh pr create --title "Changelog for ${{ needs.version.outputs.version }}" --body "This PR updates the changelog for version ${{ needs.version.outputs.version }}."
fi
Expand Down

0 comments on commit dff41e2

Please sign in to comment.