Skip to content

Allow skipping check with a 'no-issue' label on the PR #650

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GitHub action to check if pull requests have their corresponding issues linked,
|-----------------------|------------------------------------------------------------------|
| `linked_issues_count` | The total number of issues linked to your pull request. |
| `issues` | A stringified array containing the numbers of the linked issues, of the form ["some/repo#123", "another/repository#456"] |
| `check_skipped` | Will be set to `true` if the action was skipped due to a `no-issue` label present on the PR. |


## Standard Usage
Expand All @@ -30,6 +31,8 @@ Configure a workflow to run a job on `pull_request` or `pull_request_target` ev
If you enable the `comment` option (enabled by default) we recommend to listen on `pull_request_target` event.
`pull_request_target` event has write permission to the target repository allowing external forks to create comments.

The linked issue check will automatically succeed (and any present comment added by this action deleted) if a `no-issue` label is attached to the PR. In that case, the `check_skipped` output will also be set to `true`, allowing you to skip subsequent steps in your Github Action, if so desired.

### Permissions

This action needs the following permissions:
Expand Down Expand Up @@ -68,7 +71,7 @@ When the action cannot find any linked issues it will fail explaining the reason
## Comments

### Adding comments
By default, when the job fails it adds a new comment on Pull Request, but you can also write your custom comment setting
By default, when the job fails it adds a new comment on Pull Request, but you can also write your custom comment setting
`custom-body-comment`.

```yaml
Expand Down Expand Up @@ -147,4 +150,4 @@ Please **DO NOT** link issues manually from the sidebar, neither from commit mes

You can also reference issues outside of the repository on which the workflow is running. This works only if the repository containing the issue is `public`. Issues in private repositories are not accessible by this action.

[![banner](https://raw.githubusercontent.com/nearform/.github/refs/heads/master/assets/os-banner-green.svg)](https://www.nearform.com/contact/?utm_source=open-source&utm_medium=banner&utm_campaign=os-project-pages)
[![banner](https://raw.githubusercontent.com/nearform/.github/refs/heads/master/assets/os-banner-green.svg)](https://www.nearform.com/contact/?utm_source=open-source&utm_medium=banner&utm_campaign=os-project-pages)
24 changes: 24 additions & 0 deletions __mocks__/@actions/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ module.exports = {
},
],
},
labels: github.context.withNoIssueLabel
? {
nodes: [
{
name: "foo",
},
{
name: "no-issue",
},
{
name: "bar",
}
],
}
: {
nodes: [
{
name: "foo",
},
{
name: "bar",
}
],
},
},
},
});
Expand Down
Loading
Loading