Skip to content

Commit 31c415e

Browse files
authored
ci: skip schedule reporter on forks (GoogleCloudPlatform#1469)
1 parent 2dfee66 commit 31c415e

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎.github/workflows/cloud_build_failure_reporter.yml‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ on:
2929

3030
jobs:
3131
report:
32+
if: github.repository == 'GoogleCloudPlatform/cloud-sql-python-connector'
3233

3334
permissions:
3435
issues: 'write'
@@ -39,13 +40,15 @@ jobs:
3940

4041
steps:
4142
- uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # v8
43+
env:
44+
TRIGGER_NAMES: ${{ inputs.trigger_names }}
4245
with:
4346
script: |-
4447
// parse test names
45-
const testNameSubstring = '${{ inputs.trigger_names }}';
48+
const testNameSubstring = process.env.TRIGGER_NAMES || '';
4649
const testNameFound = new Map(); //keeps track of whether each test is found
4750
testNameSubstring.split(',').forEach(testName => {
48-
testNameFound.set(testName, false);
51+
testNameFound.set(testName.trim(), false);
4952
});
5053
5154
// label for all issues opened by reporter
@@ -172,8 +175,8 @@ jobs:
172175
const noTestFound = Array.from(testNameFound.values()).every(value => value === false);
173176
if (noTestFound){
174177
createOrCommentIssue(
175-
'Missing periodic tests: ${{ inputs.trigger_names }}',
176-
`No periodic test is found for triggers: ${{ inputs.trigger_names }}. Last checked from ${
178+
`Missing periodic tests: ${testNameSubstring}`,
179+
`No periodic test is found for triggers: ${testNameSubstring}. Last checked from ${
177180
commits[0].html_url
178181
} to ${commits[commits.length - 1].html_url}.`
179182
);

‎.github/workflows/schedule_reporter.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ on:
2020

2121
jobs:
2222
run_reporter:
23+
if: github.repository == 'GoogleCloudPlatform/cloud-sql-python-connector'
2324
permissions:
2425
issues: 'write'
2526
checks: 'read'
2627
contents: 'read'
2728
uses: ./.github/workflows/cloud_build_failure_reporter.yml
2829
with:
2930
trigger_names: "py-continuous-test-on-merge,py-integration-test-nightly"
31+

0 commit comments

Comments
 (0)