@@ -16,7 +16,7 @@ name: Add Label
1616
1717on :
1818 workflow_run :
19- workflows : [Tests, CodeQL ]
19+ workflows : ["MaxText Package Tests" ]
2020 types :
2121 - completed
2222 pull_request_review :
3131 runs-on : ubuntu-latest
3232
3333 steps :
34- - uses : actions/github-script@v7
34+ - name : Add Pull Request Label
35+ uses : actions/github-script@v7
3536 with :
3637 script : |
3738 const owner = "google"
4243 } else if (context.payload.workflow_run !== undefined) {
4344 if (context.payload.workflow_run.pull_requests.length === 0) {
4445 console.log("This workflow is NOT running within a PR's context")
45- process.exit()
46+ process.exit(1 )
4647 }
4748 console.log(context.payload.workflow_run.pull_requests)
4849 pull_number = context.payload.workflow_run.pull_requests[0].number
@@ -68,15 +69,15 @@ jobs:
6869
6970 if (reviews.data.length === 0) {
7071 console.log("Not adding pull ready because the PR is not approved yet.")
71- process.exit()
72+ process.exit(1 )
7273 }
7374 let is_approved = false
7475 if (decision_result.repository.pullRequest.reviewDecision === "APPROVED") {
7576 is_approved = true
7677 }
7778 if (!is_approved) {
7879 console.log("Not adding pull ready because the PR is not approved yet by sufficient code owners.")
79- process.exit()
80+ process.exit(1 )
8081 }
8182
8283 const commits = await github.rest.pulls.listCommits({
@@ -85,11 +86,11 @@ jobs:
8586 pull_number,
8687 per_page: 100,
8788 })
88- // Check that the number of commits in the PR is 1.
89- if (commits.data.length !== 1) {
90- console.log("Not adding pull ready because the PR has more than one commit. Please squash your commits.")
91- process.exit(1)
92- }
89+ // Check that the number of commits in the PR is 1. This is not enforced in practice.
90+ // if (commits.data.length !== 1) {
91+ // console.log("Not adding pull ready because the PR has more than one commit. Please squash your commits.")
92+ // process.exit(1)
93+ // }
9394 const ref = commits.data.slice(-1)[0].sha
9495 const checkRuns = await github.rest.checks.listForRef({
9596 owner,
@@ -98,13 +99,13 @@ jobs:
9899 })
99100 if (checkRuns.data.check_runs.length === 0) {
100101 console.log("Not adding pull ready because no check runs are associated with the last commit: " + ref)
101- process.exit()
102+ process.exit(1 )
102103 }
103104 for (const checkRun of checkRuns.data.check_runs) {
104105 if (checkRun.name.endsWith(context.job)) continue
105106 if (checkRun.conclusion !== "success") {
106107 console.log("Not adding pull ready because " + checkRun.name + " has not passed yet: " + checkRun.html_url)
107- process.exit()
108+ process.exit(1 )
108109 }
109110 }
110111 console.log("Adding pull ready label because the PR is approved AND all the check runs have passed")
0 commit comments