-
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
0 parents
commit 85780cb
Showing
15 changed files
with
12,361 additions
and
0 deletions.
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 @@ | ||
dist |
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,13 @@ | ||
{ | ||
"env": { | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": {} | ||
} |
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,21 @@ | ||
name: Checks | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: LouisBrunner/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: BackstopJS visual test | ||
conclusion: failure | ||
|
||
- uses: LouisBrunner/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: ESLint | ||
conclusion: failure |
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,39 @@ | ||
name: Test | ||
|
||
on: | ||
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#issue_comment | ||
# There does not exist an event specifically for PR comments which means | ||
# we need to have that check further down the action definition. | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
test: | ||
# This condition is important since you want to prevent all of the steps | ||
# from running as early as possible if the comment isn't in a PR. | ||
if: ${{ github.event.issue.pull_request }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: ./ | ||
name: Approve BackstopJS | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
check_name: BackstopJS visual test | ||
approve_comment: backstop-check approve | ||
|
||
- uses: ./ | ||
name: Approve ESLint | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
check_name: ESLint | ||
approve_comment: eslint-check approve | ||
|
||
# There is no step in checks.yml named Cypress which will lead this to fail. | ||
- uses: ./ | ||
name: Approve Cypress | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
check_name: Cypress | ||
approve_comment: cypress-check approve |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
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,7 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": true | ||
} | ||
} |
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,73 @@ | ||
# action-approve-failure | ||
|
||
GitHub action that let's you turn failure into success. For a short while. | ||
|
||
## Example | ||
|
||
Presume you have a couple of jobs that run on pull requests. | ||
(These are merely examples but take a look in `.github/workflows` for closer inspection) | ||
|
||
```yaml | ||
name: Checks | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: LouisBrunner/checks-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: BackstopJS visual test | ||
conclusion: failure | ||
|
||
- uses: LouisBrunner/checks-action@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: ESLint | ||
conclusion: failure | ||
``` | ||
These jobs might from time to time need to be forced into success since a failure | ||
might just be a new state. | ||
In comes `action-approve-failure`: | ||
|
||
```yaml | ||
name: Approve failure | ||
on: | ||
issue_comment: | ||
types: [created] | ||
jobs: | ||
approve-failure: | ||
# This condition is important since you want to prevent all of the steps | ||
# from running as early as possible if the comment isn't in a PR. | ||
if: ${{ github.event.issue.pull_request }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: reload/[email protected] | ||
name: Approve BackstopJS | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
check_name: BackstopJS visual test | ||
approve_comment: backstop-check approve | ||
- uses: reload/[email protected] | ||
name: Approve ESLint | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
check_name: ESLint | ||
approve_comment: eslint-check approve | ||
``` | ||
|
||
Now, by simply commenting `backstop-check approve` you can turn that `failure` | ||
into a `success`. The victory is short lived though. Whenever the PR get's | ||
updated and the jobs re-run your override will be lost and you are forced to | ||
yet again determine if this failure is change of state or an actual failure. |
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,14 @@ | ||
name: "Approve failure" | ||
description: "Approve any check no matter it's actual conclusion." | ||
inputs: | ||
github_token: | ||
required: true | ||
check_name: | ||
required: true | ||
default: "BackstopJS visual test" | ||
approve_comment: | ||
required: true | ||
default: "backstop-check approve" | ||
runs: | ||
using: "node16" | ||
main: "dist/index.js" |
Oops, something went wrong.