2022-10-03 13:30:21 +03:00
|
|
|
name: Write changelog for dependabot PR
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- opened
|
|
|
|
|
2022-10-03 16:34:50 +03:00
|
|
|
permissions:
|
|
|
|
# Needed to be able to push the commit. See
|
|
|
|
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
|
|
|
|
# for a similar example
|
|
|
|
contents: write
|
2022-10-03 17:59:32 +03:00
|
|
|
# The pull_requests "synchronize" event doesn't seem to fire with just `contents: write`, so
|
|
|
|
# CI doesn't run with the new changelog. Maybe `pull_requests: write` will fix this?
|
|
|
|
pull_requests: write
|
2022-10-03 16:34:50 +03:00
|
|
|
|
2022-10-03 13:30:21 +03:00
|
|
|
jobs:
|
|
|
|
add-changelog:
|
|
|
|
runs-on: 'ubuntu-latest'
|
|
|
|
if: ${{ github.actor == 'dependabot[bot]' }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
|
|
- name: Write, commit and push changelog
|
|
|
|
run: |
|
2022-10-03 13:51:57 +03:00
|
|
|
echo "${{ github.event.pull_request.title }}." > "changelog.d/${{ github.event.pull_request.number }}".misc
|
2022-10-03 13:30:21 +03:00
|
|
|
git add changelog.d
|
|
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
git config user.name "GitHub Actions"
|
|
|
|
git commit -m "Changelog"
|
|
|
|
git push
|
|
|
|
shell: bash
|
2022-10-03 17:59:32 +03:00
|
|
|
# THIS WORKFLOW HAS VARIOUS WRITE PERMISSIONS---do not add other jobs here unless they
|
|
|
|
# are sufficiently locked down to dependabot only as above.
|