-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add privileged workflows to display coverage reports in PRs from …
…fork
- Loading branch information
1 parent
469d1e5
commit 74f7894
Showing
2 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# THIS | ||
# IS | ||
# DOCUMENTATION | ||
# TRIGGERED WORKFLOW | ||
|
||
name: display backend coverage in PR | ||
|
||
on: | ||
workflow_run: | ||
workflows: [backend] | ||
types: [completed] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
acquire-pr-number: | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
PR_NUMBER: ${{ steps.acquire-pr-number.outputs.number }} | ||
permissions: | ||
contents: read | ||
steps: | ||
- id: acquire-pr-number | ||
run: gh pr view --repo "${REPOSITORY}" "${BRANCH}" --json 'number' --jq '"number=\(.number)"' >> "${GITHUB_OUTPUT}" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
REPOSITORY: ${{ github.repository }} | ||
BRANCH: |- | ||
${{ | ||
(github.event.workflow_run.head_repository.fork == true) | ||
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch) | ||
|| github.event.workflow_run.head_branch | ||
}} | ||
display-backend-coverage: | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
runs-on: ubuntu-latest | ||
needs: [acquire-pr-number] | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Download coverage reports | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: backend-coverage | ||
path: coverage/ | ||
- name: Display coverage reports | ||
uses: MishaKav/pytest-coverage-comment@main | ||
with: | ||
issue-number: ${{ needs.acquire-pr-number.outputs.PR_NUMBER }} | ||
pytest-coverage-path: coverage/coverage.txt | ||
junitxml-path: coverage/coverage.xml | ||
title: backend coverage report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# THIS | ||
# IS | ||
# DOCUMENTATION | ||
# TRIGGERED WORKFLOW | ||
|
||
name: display frontend coverage in PR | ||
|
||
on: | ||
workflow_run: | ||
workflows: [frontend] | ||
types: [completed] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: {} | ||
|
||
jobs: | ||
acquire-pr-number: | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
runs-on: ubuntu-latest | ||
outputs: | ||
PR_NUMBER: ${{ steps.acquire-pr-number.outputs.number }} | ||
permissions: | ||
contents: read | ||
steps: | ||
- id: acquire-pr-number | ||
run: gh pr view --repo "${REPOSITORY}" "${BRANCH}" --json 'number' --jq '"number=\(.number)"' >> "${GITHUB_OUTPUT}" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
REPOSITORY: ${{ github.repository }} | ||
BRANCH: |- | ||
${{ | ||
(github.event.workflow_run.head_repository.fork == true) | ||
&& format('{0}:{1}', github.event.workflow_run.head_repository.owner.login, github.event.workflow_run.head_branch) | ||
|| github.event.workflow_run.head_branch | ||
}} | ||
display-frontend-coverage: | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
runs-on: ubuntu-latest | ||
needs: [acquire-pr-number] | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- name: Download coverage reports | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: frontend-coverage | ||
path: coverage/ | ||
- name: Display coverage reports | ||
uses: davelosert/vitest-coverage-report-action@v2 | ||
with: | ||
pr-number: ${{ needs.acquire-pr-number.outputs.PR_NUMBER }} | ||
name: frontend coverage report |