Skip to content

Commit

Permalink
fix: conclude check should only run with a check_id
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Oct 25, 2022
1 parent 5756314 commit 3d7e5e8
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
run: npm run postlint --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
Expand Down Expand Up @@ -209,7 +209,7 @@ jobs:
run: npm test --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
return commentId
- name: Get Workflow Job
uses: actions/github-script@v6
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
id: check-output
env:
JOB_NAME: "Release"
Expand Down Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
echo "::set-output name=sha::$(git rev-parse HEAD)"
- name: Get Workflow Job
uses: actions/github-script@v6

if: steps.commit.outputs.sha
id: check-output
env:
JOB_NAME: "Update - Release"
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check

if: steps.commit.outputs.sha
with:
token: ${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand All @@ -223,7 +223,7 @@ jobs:
output: ${{ steps.check-output.outputs.result }}
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.release.outputs.check-id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ job.status }}
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
echo "::set-output name=result::$result"
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.update.outputs.check-id && always()
with:
token: ${{ secrets.GITHUB_TOKEN }}
conclusion: ${{ steps.needs-result.outputs.result }}
Expand Down
14 changes: 7 additions & 7 deletions lib/content/_step-checks.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{#if jobCheck.sha}}
- name: Get Workflow Job
uses: actions/github-script@v6
{{#if jobCheck.if}}if: {{ jobCheck.if }}{{/if}}
if: {{ jobCheck.sha }}
id: check-output
env:
JOB_NAME: "{{#if jobName}}{{ jobName }}{{else}}{{ jobCheck.name }}{{/if}}"
Expand All @@ -21,7 +21,7 @@
const job = data.jobs.find(j => j.name.endsWith(jobName))
const jobUrl = job?.html_url
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/{{ jobCheck.sha }}`
const shaUrl = `${context.serverUrl}/${owner}/${repo}/commit/$\{{ {{ jobCheck.sha }} }}`
let summary = `This check is assosciated with ${shaUrl}\n\n`
Expand All @@ -37,18 +37,18 @@
uses: LouisBrunner/checks-action@v1.3.1
{{#if jobCheck.sha}}
id: check
{{#if jobCheck.if}}if: {{ jobCheck.if }}{{/if}}
if: {{ jobCheck.sha }}
{{else}}
if: always()
if: {{#if jobCheck.id}}{{ jobCheck.id }}{{else}}steps.check.outputs.check_id{{/if}} && always()
{{/if}}
with:
token: $\{{ secrets.GITHUB_TOKEN }}
{{#if jobCheck.sha}}
status: {{#if jobCheck.status}}{{ jobCheck.status }}{{else}}in_progress{{/if}}
name: {{#if jobCheck.name}}{{ jobCheck.name }}{{else}}{{ jobName }}{{/if}}{{#if jobIsMatrix}} - $\{{ matrix.platform.name }} - $\{{ matrix.node-version }}{{/if}}
sha: {{ jobCheck.sha }}
sha: $\{{ {{ jobCheck.sha }} }}
output: $\{{ steps.check-output.outputs.result }}
{{else}}
conclusion: {{#if jobCheck.status}}{{ jobCheck.status }}{{else}}$\{{ job.status }}{{/if}}
check_id: {{#if jobCheck.id}}{{ jobCheck.id }}{{else}}$\{{ steps.check.outputs.check_id }}{{/if}}
conclusion: $\{{ {{#if jobCheck.status}}{{ jobCheck.status }}{{else}}job.status{{/if}} }}
check_id: $\{{ {{#if jobCheck.id}}{{ jobCheck.id }}{{else}}steps.check.outputs.check_id{{/if}} }}
{{/if}}
4 changes: 2 additions & 2 deletions lib/content/ci-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
lint-all:
{{> job
jobName="Lint All"
jobCheck=(obj sha="${{ inputs.check-sha }}" if="inputs.check-sha")
jobCheck=(obj sha="inputs.check-sha")
jobCheckout=(obj ref="${{ inputs.ref }}")
}}
{{> stepLint jobRunFlags=allFlags }}
Expand All @@ -30,7 +30,7 @@ jobs:
test-all:
{{> jobMatrix
jobName="Test All"
jobCheck=(obj sha="${{ inputs.check-sha }}" if="inputs.check-sha")
jobCheck=(obj sha="inputs.check-sha")
jobCheckout=(obj ref="${{ inputs.ref }}")
}}
{{> stepTest jobRunFlags=allFlags }}
Expand Down
8 changes: 4 additions & 4 deletions lib/content/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
}
return commentId
{{> stepChecks jobCheck=(obj name="Release" sha="${{ steps.release.outputs.pr-sha }}" if="steps.release.outputs.pr-number") }}
{{> stepChecks jobCheck=(obj name="Release" sha="steps.release.outputs.pr-sha") }}

update:
needs: release
Expand Down Expand Up @@ -92,8 +92,8 @@ jobs:
git commit --all --amend --no-edit || true
git push --force-with-lease
echo "::set-output name=sha::$(git rev-parse HEAD)"
{{> stepChecks jobName="Update - Release" jobCheck=(obj sha="${{ steps.commit.outputs.sha }}" name="Release" )}}
{{> stepChecks jobCheck=(obj id="${{ needs.release.outputs.check-id }}" )}}
{{> stepChecks jobName="Update - Release" jobCheck=(obj sha="steps.commit.outputs.sha" name="Release" )}}
{{> stepChecks jobCheck=(obj id="needs.release.outputs.check-id" )}}

ci:
name: CI - Release
Expand All @@ -119,7 +119,7 @@ jobs:
result="success"
fi
echo "::set-output name=result::$result"
{{> stepChecks jobCheck=(obj id="${{ needs.update.outputs.check-id }}" status="${{ steps.needs-result.outputs.result }}") }}
{{> stepChecks jobCheck=(obj id="needs.update.outputs.check-id" status="steps.needs-result.outputs.result") }}

post-release:
needs: release
Expand Down
48 changes: 24 additions & 24 deletions tap-snapshots/test/apply/source-snapshots.js.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ jobs:
run: npm run postlint --ignore-scripts
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -416,7 +416,7 @@ jobs:
run: npm test --ignore-scripts
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -891,7 +891,7 @@ jobs:
return commentId
- name: Get Workflow Job
uses: actions/github-script@v6
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
id: check-output
env:
JOB_NAME: "Release"
Expand Down Expand Up @@ -925,7 +925,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
with:
token: \${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand Down Expand Up @@ -982,7 +982,7 @@ jobs:
echo "::set-output name=sha::$(git rev-parse HEAD)"
- name: Get Workflow Job
uses: actions/github-script@v6
if: steps.commit.outputs.sha
id: check-output
env:
JOB_NAME: "Update - Release"
Expand Down Expand Up @@ -1016,7 +1016,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check
if: steps.commit.outputs.sha
with:
token: \${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand All @@ -1025,7 +1025,7 @@ jobs:
output: \${{ steps.check-output.outputs.result }}
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.release.outputs.check-id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -1063,7 +1063,7 @@ jobs:
echo "::set-output name=result::$result"
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.update.outputs.check-id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ steps.needs-result.outputs.result }}
Expand Down Expand Up @@ -1903,7 +1903,7 @@ jobs:
run: npm run postlint --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -2018,7 +2018,7 @@ jobs:
run: npm test --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -2499,7 +2499,7 @@ jobs:
return commentId
- name: Get Workflow Job
uses: actions/github-script@v6
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
id: check-output
env:
JOB_NAME: "Release"
Expand Down Expand Up @@ -2533,7 +2533,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
with:
token: \${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand Down Expand Up @@ -2590,7 +2590,7 @@ jobs:
echo "::set-output name=sha::$(git rev-parse HEAD)"
- name: Get Workflow Job
uses: actions/github-script@v6
if: steps.commit.outputs.sha
id: check-output
env:
JOB_NAME: "Update - Release"
Expand Down Expand Up @@ -2624,7 +2624,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check
if: steps.commit.outputs.sha
with:
token: \${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand All @@ -2633,7 +2633,7 @@ jobs:
output: \${{ steps.check-output.outputs.result }}
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.release.outputs.check-id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -2671,7 +2671,7 @@ jobs:
echo "::set-output name=result::$result"
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.update.outputs.check-id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ steps.needs-result.outputs.result }}
Expand Down Expand Up @@ -3513,7 +3513,7 @@ jobs:
run: npm run postlint --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -3628,7 +3628,7 @@ jobs:
run: npm test --ignore-scripts -ws -iwr --if-present
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: steps.check.outputs.check_id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -3851,7 +3851,7 @@ jobs:
return commentId
- name: Get Workflow Job
uses: actions/github-script@v6
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
id: check-output
env:
JOB_NAME: "Release"
Expand Down Expand Up @@ -3885,7 +3885,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check
if: steps.release.outputs.pr-number
if: steps.release.outputs.pr-sha
with:
token: \${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand Down Expand Up @@ -3942,7 +3942,7 @@ jobs:
echo "::set-output name=sha::$(git rev-parse HEAD)"
- name: Get Workflow Job
uses: actions/github-script@v6
if: steps.commit.outputs.sha
id: check-output
env:
JOB_NAME: "Update - Release"
Expand Down Expand Up @@ -3976,7 +3976,7 @@ jobs:
- name: Create Check
uses: LouisBrunner/checks-action@v1.3.1
id: check
if: steps.commit.outputs.sha
with:
token: \${{ secrets.GITHUB_TOKEN }}
status: in_progress
Expand All @@ -3985,7 +3985,7 @@ jobs:
output: \${{ steps.check-output.outputs.result }}
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.release.outputs.check-id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ job.status }}
Expand Down Expand Up @@ -4023,7 +4023,7 @@ jobs:
echo "::set-output name=result::$result"
- name: Conclude Check
uses: LouisBrunner/checks-action@v1.3.1
if: always()
if: needs.update.outputs.check-id && always()
with:
token: \${{ secrets.GITHUB_TOKEN }}
conclusion: \${{ steps.needs-result.outputs.result }}
Expand Down

0 comments on commit 3d7e5e8

Please sign in to comment.