Skip to content

Commit

Permalink
HCE-721 Enable Auto Dependabot Changelogs (#150)
Browse files Browse the repository at this point in the history
* enable dependabot changelogs

* changelog

* newline
  • Loading branch information
itsjaspermilan authored Dec 13, 2022
1 parent fdd8549 commit 7c4369d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/150.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
Enable automatic changelog creation for dependabot PRs.
```
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ updates:
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
labels:
- "pr/no-changelog"

- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
labels:
- "pr/no-changelog"
37 changes: 37 additions & 0 deletions .github/workflows/create-dependabot-changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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'}}
steps:
- uses: actions/checkout@v3
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

0 comments on commit 7c4369d

Please sign in to comment.