Skip to content

Commit

Permalink
fixup! feat(github-actions): introduce action to identify PRs affecti…
Browse files Browse the repository at this point in the history
…ng Google

Address feedback
  • Loading branch information
devversion committed Oct 10, 2022
1 parent c062701 commit eb0eca9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
32 changes: 14 additions & 18 deletions github-actions/google-internal-tests/lib/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,24 @@ async function main() {
}
}

const status = affectsGoogle
? ({
state: 'pending',
// The initial waiting status is expected to be overridden by the
// internal presubmit status service then.
description: `Waiting for Google Internal Tests. ${
runTestGuideURL ? `@Googlers: See Details for instructions -->` : ''
}`.trim(),
url: runTestGuideURL,
} as const)
: ({
state: 'success',
description: 'Does not affect Google.',
} as const);
const waitingForG3Status = {
state: 'pending' as const,
// The initial waiting status is expected to be overridden by the
// internal presubmit status service then.
description: `Waiting for Google Internal Tests. ${
runTestGuideURL ? `@Googlers: See Details for instructions -->` : ''
}`.trim(),
target_url: runTestGuideURL,
};
const irrelevantToG3Status = {
state: 'success' as const,
description: 'Does not affect Google.',
};

await github.repos.createCommitStatus({
...context.repo,
...(affectsGoogle ? waitingForG3Status : irrelevantToG3Status),
sha: prHeadSHA,
state: status.state,
description: status.description,
context: 'google-internal-tests',
target_url: status.url,
});
}

Expand Down
14 changes: 6 additions & 8 deletions github-actions/google-internal-tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16600,21 +16600,19 @@ async function main() {
break;
}
}
const status = affectsGoogle ? {
const waitingForG3Status = {
state: "pending",
description: `Waiting for Google Internal Tests. ${runTestGuideURL ? `@Googlers: See Details for instructions -->` : ""}`.trim(),
url: runTestGuideURL
} : {
target_url: runTestGuideURL
};
const irrelevantToG3Status = {
state: "success",
description: "Does not affect Google."
};
await github.repos.createCommitStatus({
...import_github.context.repo,
sha: prHeadSHA,
state: status.state,
description: status.description,
context: "google-internal-tests",
target_url: status.url
...affectsGoogle ? waitingForG3Status : irrelevantToG3Status,
sha: prHeadSHA
});
}
function constructPatterns(rawPatterns) {
Expand Down

0 comments on commit eb0eca9

Please sign in to comment.