Skip to content

Bump the rust group across 1 directory with 3 updates #30

Bump the rust group across 1 directory with 3 updates

Bump the rust group across 1 directory with 3 updates #30

name: Update Changelog
on:
issue_comment:
types: [created]
jobs:
update-changelog:
# Only run if this is a comment on a PR containing "@actions-user changelog"
# and not a comment made by GitHub Action to avoid infinite loops
if: github.event.issue.pull_request && contains(github.event.comment.body, '@actions-user changelog') && github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Get PR details
id: pr-details
uses: actions/github-script@v7
with:
script: |
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
core.setOutput('number', pullRequest.number);
core.setOutput('title', pullRequest.title);
core.setOutput('head_ref', pullRequest.head.ref);
- name: Checkout repository
uses: actions/checkout@v5
with:
# Checkout the PR head ref
ref: ${{ steps.pr-details.outputs.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Update changelog
run: |
python modify_changelog.py update_changelog \
"${{ steps.pr-details.outputs.number }}" \
'${{ steps.pr-details.outputs.title }}'
- name: Check for changes
id: changes
run: |
if git diff --quiet docs/changelog.md; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.changes.outputs.changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add docs/changelog.md
git commit -m "Add changelog entry for PR #${{ steps.pr-details.outputs.number }}"
git push