-
Notifications
You must be signed in to change notification settings - Fork 1
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 #223 from chizmw/add-dependabot-changeset-action
Add dependabot changeset action
- Loading branch information
Showing
2 changed files
with
75 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,5 @@ | ||
--- | ||
'arcane-scripts': patch | ||
--- | ||
|
||
chore: add dependabot changeset action workflow |
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,70 @@ | ||
--- | ||
name: Dependabot | ||
|
||
# yamllint disable-line rule:truthy | ||
on: | ||
pull_request_target: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
add-changeset-fragment: | ||
name: Add changeset fragment | ||
runs-on: ubuntu-latest | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
|
||
steps: | ||
# Find the PR associated with this push, if there is one. | ||
- uses: jwalton/gh-find-current-pr@v1 | ||
id: find-pr | ||
with: | ||
# Can be "open", "closed", or "all". Defaults to "open". | ||
state: open | ||
# This will echo "Your PR is 7", or be skipped if there is no current PR. | ||
- run: echo "Your PR is ${PR}" | ||
if: success() && steps.find-pr.outputs.number | ||
env: | ||
PR: ${{ steps.find-pr.outputs.pr }} | ||
|
||
- uses: boonya/gh-action-name-generator@v1 | ||
if: success() && steps.find-pr.outputs.number | ||
id: generator | ||
with: | ||
style: lowerCase | ||
separator: '-' | ||
length: 3 | ||
- run: | | ||
echo "Generated name is: ${{ steps.generator.outputs.name }}" | ||
- uses: actions/checkout@v3 | ||
if: success() && steps.find-pr.outputs.number | ||
with: | ||
# https://github.com/marketplace/actions/add-commit#working-with-prs | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Setup Git User | ||
if: success() && steps.find-pr.outputs.number | ||
uses: fregante/setup-git-user@v2 | ||
|
||
- name: Render template | ||
id: render | ||
uses: chuhlomin/[email protected] | ||
if: success() && steps.find-pr.outputs.number | ||
with: | ||
template: .github/dependabot-changeset.template.md | ||
vars: | | ||
prTitle: '${{ steps.find-pr.outputs.title }}' | ||
- name: Create Changeset Fragment | ||
if: success() && steps.find-pr.outputs.number | ||
shell: bash | ||
# yamllint disable rule:line-length | ||
run: | | ||
echo "${{ steps.render.outputs.result }}" > .changeset/${{ steps.generator.outputs.name }}.md | ||
cat .changeset/${{ steps.generator.outputs.name }}.md | ||
git add .changeset/${{ steps.generator.outputs.name }}.md | ||
git commit -m "docs(changeset): add changeset fragment for ${{ steps.find-pr.outputs.title }}" | ||
git push origin HEAD | ||
# yamllint enable rule:line-length |