diff options
author | Tom Stellard <tstellar@redhat.com> | 2024-04-01 15:17:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-01 15:17:24 -0700 |
commit | 649f9603a2da82a32830ce1dc7ce5825d3766a1d (patch) | |
tree | f53fc26ecab5244bbe9f30970c62f147ac055874 | |
parent | 1e15371dd8843dfc52b9435afaa133997c1773d8 (diff) | |
download | llvm-649f9603a2da82a32830ce1dc7ce5825d3766a1d.zip llvm-649f9603a2da82a32830ce1dc7ce5825d3766a1d.tar.gz llvm-649f9603a2da82a32830ce1dc7ce5825d3766a1d.tar.bz2 |
[workflows] issue-write: Avoid race condition when PR branch is deleted (#87118)
Fixes #87102 .
-rw-r--r-- | .github/workflows/issue-write.yml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/.github/workflows/issue-write.yml b/.github/workflows/issue-write.yml index f5b84fe..4a564a5 100644 --- a/.github/workflows/issue-write.yml +++ b/.github/workflows/issue-write.yml @@ -77,6 +77,15 @@ jobs: } const gql_result = await github.graphql(gql_query, gql_variables); console.log(gql_result); + // If the branch for the PR was deleted before this job has a chance + // to run, then the ref will be null. This can happen if someone: + // 1. Rebase the PR, which triggers some workflow. + // 2. Immediately merges the PR and deletes the branch. + // 3. The workflow finishes and triggers this job. + if (!gql_result.repository.ref) { + console.log("Ref has been deleted"); + return; + } console.log(gql_result.repository.ref.associatedPullRequests.nodes); var pr_number = 0; |