Skip to content

Commit 09fde4e

Browse files
authored
GHA - Set PR numbers for forked repos (#3195)
1 parent 47292b3 commit 09fde4e

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

.github/workflows/ci-pr-coverage.yaml

+7-4
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ jobs:
1919
with:
2020
run-id: ${{ github.event.workflow_run.id }}
2121
github-token: ${{ secrets.GH_PAT }}
22-
pattern: coverage-*
2322
merge-multiple: true
24-
23+
- name: Read PR
24+
uses: actions/github-script@v7
25+
id: set-pr
26+
with:
27+
script: return Number(fs.readFileSync('./NR'));
28+
result-encoding: string
2529
- name: Upload coverage report
2630
if: '!cancelled()'
2731
uses: codecov/codecov-action@v4
2832
with:
2933
override_commit: ${{ github.event.workflow_run.head_sha }}
30-
override_pr: ${{ github.event.workflow_run.pull_requests[0].number }}
31-
override_build: ${{ github.event.workflow_run.id }}
34+
override_pr: ${{steps.set-pr.outputs.result}}
3235
token: ${{ secrets.CODECOV_TOKEN }}
3336
exclude: ".github"
3437
files: ".coverage.3.8.xml,.coverage.3.9.xml,.coverage.3.10.xml,.coverage.3.11.xml,.coverage.3.12.xml"

.github/workflows/ci-pr.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ jobs:
3131
with:
3232
name: coverage-${{ matrix.python }}
3333
path: .coverage.${{ matrix.python }}.xml
34+
- name: Save PR number
35+
run: |
36+
mkdir -p ./pr
37+
echo ${{ github.event.number }} > ./pr/NR
38+
- uses: actions/upload-artifact@v2
39+
with:
40+
name: pr
41+
path: pr/
3442
integration:
3543
runs-on: ${{ matrix.os }}
3644
strategy:

0 commit comments

Comments
 (0)