Skip to content

Commit

Permalink
chore: tweak dependabot config
Browse files Browse the repository at this point in the history
  • Loading branch information
edodusi committed Jan 20, 2025
1 parent 319f7c1 commit ab5b522
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 12 deletions.
8 changes: 7 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ updates:
- 'storyblok*'
update-types:
- patch
- minor
storyblok:
patterns:
- 'storyblok*'
update-types:
- patch
- minor
ignore:
- dependency-name: '*'
update-types:
- version-update:semver-minor
- version-update:semver-major
28 changes: 28 additions & 0 deletions .github/workflows/dependabot-autoapprove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Dependabot auto-approve
on: pull_request

permissions:
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'storyblok/storyblok-svelte'
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
alert-lookup: true
- uses: actions/checkout@v4
- name: Approve a PR if not already approved
run: |
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then gh pr review --approve "$PR_URL"
else echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
fi
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
17 changes: 6 additions & 11 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Dependabot auto-approve
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
Expand All @@ -14,15 +15,9 @@ jobs:
uses: dependabot/fetch-metadata@v2
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
alert-lookup: true
- uses: actions/checkout@v4
- name: Approve a PR if not already approved
run: |
gh pr checkout "$PR_URL" # sets the upstream metadata for `gh pr status`
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ];
then gh pr review --approve "$PR_URL"
else echo "PR already approved, skipping additional approvals to minimize emails/notification noise.";
fi
- name: Enable auto-merge for Dependabot PRs with Storyblok updates
if: contains(steps.metadata.outputs.dependency-names, '*storyblok') && (steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor')
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit ab5b522

Please sign in to comment.