Skip to content

Commit

Permalink
Fix issue with 'createchangelog' workflow always switching to Git Det…
Browse files Browse the repository at this point in the history
…ached Head Mode
  • Loading branch information
og-mrk committed Jul 29, 2024
1 parent c63c9aa commit 822a92d
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/createchangelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ jobs:
submodules: 'recursive'
ref: ${{ github.ref }}

- name: Make sure current branch is 'main' branch if ref name isn't valid branch
run: |
# NOTE/TODO:
# Because there's a chance where this'll get triggered by a Release Creation, Edit, Deletion..
# the value of 'github.ref' will be 'refs/tags/TAG-NAME', and this tag can not be handled easily by
# the 'actions/checkout' action.. we need to handle this case by always changing to main branch.
declare -rA number_of_refname_instances=$(git branch -a | grep -Po '${{ github.ref_name }}' | wc --lines)
if [[ $number_of_refname_instances = 0 ]] ; then
git switch main
git pull
fi
- name: Get all releases and update changelog.md file
run: |
# Initialize some values
Expand Down Expand Up @@ -112,10 +124,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ['${{ github.event_name }}' = 'release']; then
git branch --contains ${{ github.ref }} | grep -Po '\*\s*.*' | sed 's/\* //g' > branch_name.txt
fi
cat branch_name.txt
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add docs/changelog.md
Expand Down

0 comments on commit 822a92d

Please sign in to comment.