Skip to content

Commit

Permalink
Disable PR comment by default from forks (#64)
Browse files Browse the repository at this point in the history
Forked PRs can fail to access the secrets for the repository. This can
fail on trying to comment the results from CI on the PR. Disable
comments for all forked by default.
  • Loading branch information
emcfarlane authored Aug 20, 2024
1 parent 0d29f75 commit 1925ed2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ Add these parameters under the `with` section of the `uses` step in the workflow
| `paths` | Limit to specific files or directories (separated by newlines). | |
| `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. The workflow and job name combination must be unique. | Only on pull requests |
| `pr_comment` | Comment the results on the pull request. The workflow and job name combination must be unique. | Only on pull requests (non forks) |
| `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 |
| `breaking_against` | [Input](https://buf.build/docs/reference/inputs) to compare against. | Base of the PR or the commit before the event |
| `push` | Whether to run the push step. | Runs on Git pushes |
| `push` | Whether to run the push step. | Runs on Git pushes (non forks) |
| `push_disable_create` | Disables repository creation if it does not exist. | False |
| `archive` | Whether to run the archive step. | Runs on Git deletes |
| `archive` | Whether to run the archive step. | Runs on Git deletes (non forks) |
| `setup_only` | Setup only the `buf` environment, optionally logging into the BSR, but without executing other commands. | |
| `github_actor` | GitHub actor for API requests. | Actor from GitHub context |
| `github_token` | GitHub token for API requests. Ensures requests aren't rate limited | Token from GitHub context |
Expand Down
7 changes: 4 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ inputs:
pr_comment:
description: |-
Comment on the pull request with the results of each step. The workflow and job name combination must be unique.
Only runs on pull requests, for non forked repositories.
required: false
default: ${{ github.event_name == 'pull_request' }}
default: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}

input:
description: |-
Expand Down Expand Up @@ -115,7 +116,7 @@ inputs:

push:
description: |-
Whether to run the push step. Runs by default on pushes.
Whether to run the push step. Runs by default on pushes, for non forked repositories.
required: false
default: ${{ github.event_name == 'push' }}
push_disable_create:
Expand All @@ -126,7 +127,7 @@ inputs:

archive:
description: |-
Whether to run the archive step. Runs by default on deletes.
Whether to run the archive step. Runs by default on deletes, for non forked repositories.
required: false
default: ${{ github.event_name == 'delete' }}

Expand Down

0 comments on commit 1925ed2

Please sign in to comment.