Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependabot_automerge.yml #1072

Closed
wants to merge 1 commit into from
Closed
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
59 changes: 24 additions & 35 deletions .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
name: Dependabot auto-merge
on:
pull_request
name: "Test hcaptcha"

permissions:
contents: write
pull-requests: write
on:
push:
branches:
- master
- main
paths:
- 'hcaptcha/**'
pull_request:
paths:
- 'hcaptcha/**'

jobs:
wait_for_checks:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Wait for check is finished
uses: lewagon/wait-on-check-action@v1.3.3
id: wait_for_checks
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
running-workflow-name: wait_for_checks
check-regexp: Tests
repo-token: ${{ secrets.PR_TOKEN }}
wait-interval: 10
dependabot:
needs: [wait_for_checks]
name: Dependabot auto-merge
Tests:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
strategy:
matrix:
go-version:
- 1.21.x
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.0.0
- name: Fetch Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
github-token: "${{ secrets.PR_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PR_TOKEN}}
go-version: '${{ matrix.go-version }}'
- name: Run Test
working-directory: ./hcaptcha
run: go test -v -race ./...
Comment on lines +15 to +30
Copy link

Choose a reason for hiding this comment

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

The job configuration is well-structured. However, consider specifying a fail-fast strategy in the matrix to handle failing tests more efficiently.

17a
+      fail-fast: false

Committable suggestion

鈥硷笍 IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
Tests:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
strategy:
matrix:
go-version:
- 1.21.x
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.0.0
- name: Fetch Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
github-token: "${{ secrets.PR_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: |
gh pr review --approve "$PR_URL"
gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.PR_TOKEN}}
go-version: '${{ matrix.go-version }}'
- name: Run Test
working-directory: ./hcaptcha
run: go test -v -race ./...
Tests:
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- 1.21.x
fail-fast: false
steps:
- name: Fetch Repository
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '${{ matrix.go-version }}'
- name: Run Test
working-directory: ./hcaptcha
run: go test -v -race ./...