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