Use check-job-skipped.ts in other workflows (#3653)
This commit is contained in:
1
.github/scripts/check-job-skipped.ts
vendored
1
.github/scripts/check-job-skipped.ts
vendored
@@ -20,6 +20,7 @@ async function run() {
|
|||||||
if (!job) throw new Error(`job with name ${jobName} not found in workflow run with id ${run_id}`);
|
if (!job) throw new Error(`job with name ${jobName} not found in workflow run with id ${run_id}`);
|
||||||
|
|
||||||
core.setOutput('was_skipped', job.conclusion === 'skipped');
|
core.setOutput('was_skipped', job.conclusion === 'skipped');
|
||||||
|
core.setOutput('was_skipped_or_cancelled', job.conclusion === 'skipped' || job.conclusion === 'cancelled');
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
18
.github/workflows/pr-bloaty-ios.yml
vendored
18
.github/workflows/pr-bloaty-ios.yml
vendored
@@ -17,13 +17,19 @@ jobs:
|
|||||||
if: github.event.workflow_run.event == 'pull_request'
|
if: github.event.workflow_run.event == 'pull_request'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
should_skip: ${{ steps.check_skip.outputs.should_skip }}
|
should_skip: ${{ steps.parent_workflow.outputs.was_skipped_or_cancelled }}
|
||||||
steps:
|
steps:
|
||||||
- id: check_skip
|
- uses: actions/checkout@v4
|
||||||
run: |
|
with:
|
||||||
conclusion=$(curl --retry 12 --retry-all-errors ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "ios-build").conclusion')
|
sparse-checkout: .github
|
||||||
should_skip=$([[ "$conclusion" = "skipped" || "$conclusion" = "cancelled" ]] && echo "true" || echo "false")
|
|
||||||
echo "should_skip=$should_skip" >> "$GITHUB_OUTPUT"
|
- name: Get parent workflow result
|
||||||
|
id: parent_workflow
|
||||||
|
run: node .github/scripts/check-job-skipped.ts
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TEST_RUN_ID: ${{ github.event.workflow_run.id }}
|
||||||
|
JOB_NAME: ios-build
|
||||||
|
|
||||||
pr-bloaty-ios:
|
pr-bloaty-ios:
|
||||||
needs: pre_job
|
needs: pre_job
|
||||||
|
|||||||
18
.github/workflows/pr-linux-tests.yml
vendored
18
.github/workflows/pr-linux-tests.yml
vendored
@@ -20,13 +20,19 @@ jobs:
|
|||||||
if: github.event.workflow_run.event == 'pull_request'
|
if: github.event.workflow_run.event == 'pull_request'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
should_skip: ${{ steps.check_skip.outputs.should_skip }}
|
should_skip: ${{ steps.parent_workflow.outputs.was_skipped_or_cancelled }}
|
||||||
steps:
|
steps:
|
||||||
- id: check_skip
|
- uses: actions/checkout@v4
|
||||||
run: |
|
with:
|
||||||
conclusion=$(curl --retry 12 --retry-all-errors ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "linux-build-and-test").conclusion')
|
sparse-checkout: .github
|
||||||
should_skip=$([[ "$conclusion" = "skipped" || "$conclusion" = "cancelled" ]] && echo "true" || echo "false")
|
|
||||||
echo "should_skip=$should_skip" >> "$GITHUB_OUTPUT"
|
- name: Get parent workflow result
|
||||||
|
id: parent_workflow
|
||||||
|
run: node .github/scripts/check-job-skipped.ts
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TEST_RUN_ID: ${{ github.event.workflow_run.id }}
|
||||||
|
JOB_NAME: linux-build-and-test
|
||||||
|
|
||||||
pr-bloaty:
|
pr-bloaty:
|
||||||
needs: pre_job
|
needs: pre_job
|
||||||
|
|||||||
18
.github/workflows/upload-coverage.yml
vendored
18
.github/workflows/upload-coverage.yml
vendored
@@ -10,13 +10,19 @@ jobs:
|
|||||||
pre_job:
|
pre_job:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
should_run: ${{ steps.check_skip.outputs.should_run }}
|
should_run: ${{ !steps.parent_workflow.outputs.was_skipped_or_cancelled }}
|
||||||
steps:
|
steps:
|
||||||
- id: check_skip
|
- uses: actions/checkout@v4
|
||||||
run: |
|
with:
|
||||||
conclusion=$(curl --retry 12 --retry-all-errors ${{ github.event.workflow_run.jobs_url }} | jq -r '.jobs[] | select(.name == "linux-coverage").conclusion')
|
sparse-checkout: .github
|
||||||
should_run=$([[ "$conclusion" = "success" ]] && echo "true" || echo "false")
|
|
||||||
echo "should_run=$should_run" >> "$GITHUB_OUTPUT"
|
- name: Get parent workflow result
|
||||||
|
id: parent_workflow
|
||||||
|
run: node .github/scripts/check-job-skipped.ts
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
TEST_RUN_ID: ${{ github.event.workflow_run.id }}
|
||||||
|
JOB_NAME: linux-coverage
|
||||||
|
|
||||||
upload-coverage:
|
upload-coverage:
|
||||||
needs: pre_job
|
needs: pre_job
|
||||||
|
|||||||
Reference in New Issue
Block a user