Skip to content

Commit

Permalink
Add ignore_refs parameter
Browse files Browse the repository at this point in the history
Adds a new param `ignore_refs` to skip refs that match glob
expressions. This defaults to `dependabot/*` to ignore dependabot runs
which don't have access to secrets.
  • Loading branch information
emcfarlane committed Jul 9, 2024
1 parent d3b2210 commit 9dee3f0
Show file tree
Hide file tree
Showing 8 changed files with 2,253 additions and 17 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,30 @@ jobs:
push: true # Push to re-create.
archive: true # Archive the pushed module.
comment: false
test-ignore-refs:
# Check the ignore_refs input.
runs-on: ubuntu-latest
needs:
- test-build
steps:
- uses: actions/checkout@v4
- env:
BUF_USERNAME: ${{ secrets.BUF_USERNAME }}
run: |
mkdir -p foo/v1
printf "version: v2\nname: ${BUF_MODULE}\n" > buf.yaml
printf "syntax = \"proto3\";\npackage foo.v1;\nmessage Bar {}\n" > foo/v1/bar.proto
- uses: ./
with:
username: ${{ secrets.BUF_USERNAME }}
token: ${{ secrets.BUF_TOKEN }}
ignore_refs: ${{ github.ref_name }}
lint: false
format: false
breaking: false
push: false
archive: false
comment: false
id: buf-action
- run: |
echo "${{ steps.buf-action.outputs.out }}" | grep "Skipping steps due to ref"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Add these parameters under the `with` section of the `uses` step in the workflow
| `exclude_imports` | Exclude files imported by the target modules. | False |
| `exclude_paths` | Exclude specific files or directories, e.g. "proto/a/a.proto", "proto/a" (separated by newlines). | |
| `pr_comment` | Comment the results on the pull request. | Only on pull requests |
| `ignore_refs` | Ignore specific refs expressed as glob expressions, e.g. "main", "develope/*" (separated by newlines). | Ignores dependabot ("dependabot/*") |
| `format` | Whether to run the formatting step. | Runs on pushes to Git PR |
| `lint` | Whether to run the linting step. | Runs on pushes to Git PR |
| `breaking` | Whether to run the breaking change detection step. | Runs on pushes to Git PR |
Expand Down
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ inputs:
Comment on the pull request with the results of each step.
required: false
default: ${{ github.event_name == 'pull_request' }}
ignore_refs:
description: |-
Ignore specific refs expressed as glob expressions (separated by newlines).
Example:
with:
ignore_refs: |
main
develop/*
required: false
default: "dependabot/*"

input:
description: |-
Expand Down
Loading

0 comments on commit 9dee3f0

Please sign in to comment.