We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf75fd7 commit 8d2b95cCopy full SHA for 8d2b95c
1 file changed
.github/workflows/check_pr.yml
@@ -0,0 +1,28 @@
1
+name: Check PR status for branch
2
+on:
3
+ workflow_call:
4
+ outputs:
5
+ branch-pr:
6
+ description: The PR number if the branch is in one
7
+ value: ${{ jobs.pr.outputs.branch-pr }}
8
+
9
+jobs:
10
+ pr:
11
+ runs-on: "ubuntu-latest"
12
13
+ branch-pr: ${{ steps.script.outputs.result }}
14
+ steps:
15
+ - uses: actions/github-script@v7
16
+ id: script
17
+ if: github.event_name == 'push' && github.event.ref_type != 'tag'
18
+ with:
19
+ script: |
20
+ const prs = await github.rest.pulls.list({
21
+ owner: context.repo.owner,
22
+ repo: context.repo.repo,
23
+ head: context.repo.owner + ':${{ github.ref_name }}'
24
+ })
25
+ if (prs.data.length) {
26
+ console.log(`::notice ::Skipping CI on branch push as it is already run in PR #${prs.data[0]["number"]}`)
27
+ return prs.data[0]["number"]
28
+ }
0 commit comments