-
Notifications
You must be signed in to change notification settings - Fork 5
37 lines (34 loc) · 1.47 KB
/
create-dependabot-changelog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Auto generate a changelog entry if the PR was opened by dependabot.
---
name: Create Changelog for Dependabot
on:
pull_request:
types:
- opened
jobs:
create_changelog:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]'}}
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.HCP_SDK_PIPELINE_TOKEN }}
- name: Configure git
env:
TOKEN: ${{ secrets.HCP_SDK_PIPELINE_TOKEN }}
run: |
git config --global advice.detachedHead false
git config --global url."https://${TOKEN}:[email protected]/".insteadOf "https://github.com/"
git config user.name "github-actions"
git config user.email "[email protected]"
- name: Create Changelog
run: |
echo "This is a Dependabot PR. Creating changelog entry on its behalf."
touch .changelog/${{ github.event.pull_request.number }}.txt
printf '```release-note:improvement%s\n' >> .changelog/${{ github.event.pull_request.number }}.txt
printf '${{ github.event.pull_request.title }}%s\n' >> .changelog/${{ github.event.pull_request.number }}.txt
printf '```%s\n' >> .changelog/${{ github.event.pull_request.number }}.txt
git add .
git commit -m "Added changelog entry"
git push