Skip to content

Commit

Permalink
Automatically rename changelog fragments that start with idk (#1663)
Browse files Browse the repository at this point in the history
  • Loading branch information
davfsa authored Jul 31, 2023
1 parent ae416e4 commit 53055c9
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/fragments-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,34 @@ jobs:
if [ "$changelog_fragments" != "$valid_changelog_fragments" ]; then
exit 1
fi
# We can also detect and rename idk.{}.md to valid changelog files
#
# The PR checkout is needed because we don't actually run on the checked
# out version of the PR.
- name: Try to rename 'idk' changelog fragments
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ github.event.pull_request.number }}
diff=$(git diff origin/${{ github.base_ref }} HEAD --name-only)
idk_changelog_fragments=$(echo "$diff" | grep "^changes/idk\.")
if [ -z "idk_changelog_fragments" ]; then
# Nothing to change
echo "Nothing to change, leaving as is"
exit 0
fi
while IFS= read -r filename; do
mv "$filename" ${filename/idk/${{ github.event.number }}}
done <<< "$idk_changelog_fragments"
git config --global user.name "hikari-bot"
git config --global user.email "90276125+hikari-bot[bot]@users.noreply.github.com"
git add -A
git commit -m "[ci] rename 'idk' changelog fragments"
git push

0 comments on commit 53055c9

Please sign in to comment.