-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from rmartin16/ci-workflows
Consolidate Dependabot Change Note Workflow
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Dependabot Change Note | ||
|
||
on: | ||
workflow_call: | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
changenote: | ||
name: Dependabot Change Note | ||
if: github.actor == 'dependabot[bot]' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
token: ${{ secrets.BRUTUS_PAT_TOKEN }} | ||
|
||
- name: Configure git | ||
run: | | ||
git config --local user.email "$(git log --pretty='%ae' -1)" | ||
git config --local user.name "Dependabot[bot]" | ||
- name: Commit Change Note | ||
run: | | ||
# Fetch PR number for commit from Github API | ||
API_URL="${{ github.api_url }}/repos/${{ github.repository }}/commits/${{ github.event.head_commit.id }}/pulls" | ||
PR_NUM=$(curl -s -H "Accept: application/vnd.github+json" "${API_URL}" | jq -r '.[].number') | ||
# Create change note from first line of dependabot commit | ||
NEWS=$(printf "%s" "${{ github.event.head_commit.message }}" | head -n1 | sed -e 's/Bump/Updated/') | ||
printf "%s.\n" "${NEWS}" > "./changes/${PR_NUM}.misc.rst" | ||
# Commit the change note | ||
git add "./changes/${PR_NUM}.misc.rst" | ||
# "dependabot skip" tells Dependabot to continue rebasing this branch despite foreign commits | ||
git commit -m "Add changenote. [dependabot skip]" | ||
- name: Push | ||
run: git push origin |