-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
11,657 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Test steps | ||
|
||
on: | ||
pull_request: | ||
|
||
env: | ||
LABEL: testing | ||
MISSING_LABEL: missing | ||
|
||
jobs: | ||
test: | ||
name: Test Action | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Add test label | ||
uses: actions-ecosystem/[email protected] | ||
with: | ||
labels: ${{ env.LABEL }} | ||
github_token: ${{ github.token }} | ||
|
||
- name: Check for present label | ||
uses: egmacke/action-check-label@v1 | ||
with: | ||
label: ${{ env.LABEL }} | ||
state: 'present' | ||
|
||
- name: Check for absent label | ||
uses: egmacke/action-check-label@v1 | ||
with: | ||
label: ${{ env.MISSING_LABEL }} | ||
state: 'absent' | ||
|
||
- name: Check for absent label that is present, but don't fail | ||
uses: egmacke/action-check-label@v1 | ||
with: | ||
label: ${{ env.LABEL }} | ||
state: 'absent' | ||
fail_on_error: false | ||
|
||
- name: Check for absent label that is present, and fail | ||
uses: egmacke/action-check-label@v1 | ||
continue-on-error: true | ||
with: | ||
label: ${{ env.LABEL }} | ||
state: 'absent' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,34 @@ | ||
# action-check-label | ||
Check a PR for the presence or absence of a label | ||
|
||
Github Action to check for presence or absence of a PR/issue label | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Required | Default | | ||
| --------------- | ------------------------------------------------------- | --------- | -------- | -------------------------- | | ||
| `label` | The label to test for | `string` | `true` | `N/A` | | ||
| `state` | The state of the label [`present`, `absent`] | `string` | `false` | `present` | | ||
| `github_token` | A github token | `string` | `false` | `${{github.token}}` | | ||
| `repo` | The owner and repository name | `string` | `false` | `${{ github.repository }}` | | ||
| `fail_on_error` | Whether to fail the workflow if the state doesn't match | `boolean` | `false` | `true` | | ||
|
||
## Output | ||
|
||
| Name | Description | | ||
| ----- | -------------------------------------------------------------- | | ||
| state | The actual state of the label [`present`, `absent`] | | ||
| pass | Whether the state matched the expected state [`true`, `false`] | | ||
|
||
# Example use | ||
|
||
For a simple check that a label exists on the current PR: | ||
|
||
```yml | ||
steps: | ||
- name: Check for present label | ||
uses: egmacke/action-check-label@v1 | ||
with: | ||
label: test | ||
``` | ||
For more examples, see `.github/workflows/test.yml` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: action-check-label | ||
author: egmacke | ||
description: Check for the presence or absence of a label on a PR | ||
inputs: | ||
label: | ||
description: The label to test for | ||
required: true | ||
state: | ||
description: The state of the label | ||
required: false | ||
default: 'present' | ||
github_token: | ||
description: A github token | ||
required: false | ||
default: ${{ github.token }} | ||
repo: | ||
description: The owner and repository name | ||
required: false | ||
default: ${{ github.repository }} | ||
fail_on_error: | ||
description: Whether to fail the workflow if the state doesn't match | ||
required: false | ||
default: 'true' | ||
|
||
runs: | ||
using: node12 | ||
main: dist/index.js | ||
|
||
branding: | ||
color: purple | ||
icon: bookmark | ||
|
Oops, something went wrong.