Add PHP 8.3 Support #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Changelog on PR Merge | |
on: | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
update-changelog: | |
name: Update Changelog | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} | |
fetch-depth: 0 | |
- name: Determine changelog section to update | |
id: sections | |
run: | | |
section="" | |
labels=$(echo '${{ toJSON(github.event.pull_request.labels.*.name) }}' | jq -r '.[]') | |
for label in $labels; do | |
lower_label=$(echo "$label" | tr '[:upper:]' '[:lower:]') | |
case "$lower_label" in | |
enhancement|feature) section="Added"; break;; | |
bug|bugfix|fix|patch) section="Fixed"; break;; | |
change) section="Changed"; break;; | |
optimization|improvement|performance|refactor) section="Optimized"; break;; | |
deprecation|deprecated) section="Deprecated"; break;; | |
revert) section="Reverted"; break;; | |
removal) section="Removed"; break;; | |
security) section="Security"; break;; | |
esac | |
done | |
if [ -z "$section" ]; then | |
echo "No matching label found for changelog entry, skipping changelog update." | |
exit 0 | |
else | |
echo "section=$section" >> $GITHUB_OUTPUT | |
fi | |
- name: Add entry to CHANGELOG.md | |
if: steps.sections.outputs.section != '' | |
uses: claudiodekker/changelog-updater@master | |
with: | |
section: "${{ steps.sections.outputs.section }}" | |
entry-text: "${{ github.event.pull_request.title }}" | |
entry-link: "${{ github.event.pull_request.html_url }}" | |
- name: Commit updated CHANGELOG | |
if: steps.sections.outputs.section != '' | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
branch: ${{ github.event.pull_request.base.ref }} | |
commit_message: "Update Changelog.md with changes from PR #${{ github.event.pull_request.number }}" | |
file_pattern: CHANGELOG.md |