Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/dependabot-approval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Dependabot Approval
on: pull_request
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope this to the main branch


permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'datacommonsorg/olympics'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/olympics/tools

steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2

- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL"
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_URL: ${{github.event.pull_request.html_url}}

- name: Comment and approve patch or minor updates
if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' || steps.dependabot-metadata.outputs.update-type == 'version-update:semver-minor'}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding a week of "bake time" so we are resilient to bad patches (the waiting time allows for maturity and other fixes to be applied to bad patches)

run: gh pr review $PR_URL --approve -b "Approving pull request because it includes a **patch or minor update**"
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
PR_URL: ${{github.event.pull_request.html_url}}

- name: Comment and defer for major updates
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding a label as well, so it's easy to see the status on the open pr list

if: ${{steps.dependabot-metadata.outputs.update-type == 'version-update:semver-major'}}
run: gh pr comment $PR_URL --body "Not auto-approving this pull request because it includes a **major update**"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Loading