Skip to content

Commit

Permalink
chore: get branch name from refs
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Hornhead <[email protected]>
  • Loading branch information
marchingon12 committed May 12, 2024
1 parent 25697ef commit d2e2f52
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,21 @@ jobs:
- name: Write changelog to file
run: echo "${{ steps.changelog.outputs.changelog }}" > CHANGELOG.md

- name: Get the branch name
id: branch_name
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "::set-output name=branch::${{ github.head_ref }}"
elif [[ "${GITHUB_REF}" == refs/tags/* ]]; then
echo "::set-output name=branch::main" # replace 'main' with your default branch name
else
echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"
fi
- name: Commit CHANGELOG.md
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ steps.branch_name.outputs.branch }}
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]'
file_pattern: CHANGELOG.md

Expand Down

0 comments on commit d2e2f52

Please sign in to comment.