Skip to content

Commit

Permalink
automate dependent bot (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktong authored May 21, 2023
1 parent 8e5f9d3 commit 4b1a953
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dangoslen/changelog-enforcer@v3
with:
skipLabels: Skip-Changelog,dependencies
33 changes: 33 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Dependabot
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Add a label for all production dependencies
if: ${{ steps.metadata.outputs.dependency-type == 'direct:production' }}
run: gh pr edit "$PR_URL" --add-label "Skip-Changelog"
env:
PR_URL: ${{github.event.pull_request.html_url}}
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for Dependabot PRs
if: ${{contains(steps.metadata.outputs.dependency-names, 'my-dependency') && steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 4b1a953

Please sign in to comment.