|
| 1 | +name: Test Report |
| 2 | + |
| 3 | +######################################################################### |
| 4 | +# TRIGGERS |
| 5 | +######################################################################### |
| 6 | +on: |
| 7 | + # ① Automatic – when the Test workflow ends on main / develop |
| 8 | + workflow_run: |
| 9 | + workflows: ["Test"] |
| 10 | + types: [completed] |
| 11 | + branches: [main, develop] |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + test_run_id: |
| 15 | + description: "Run ID of the completed Test workflow (see the URL)" |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + branch: |
| 19 | + description: "Branch that Test was run on" |
| 20 | + required: true |
| 21 | + type: choice |
| 22 | + options: [main, develop] |
| 23 | + default: develop |
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + actions: read |
| 27 | + checks: write |
| 28 | + |
| 29 | + |
| 30 | +jobs: |
| 31 | + discover-auto: |
| 32 | + if: ${{ github.event_name == 'workflow_run' }} # ← auto only |
| 33 | + runs-on: ubuntu-latest |
| 34 | + outputs: |
| 35 | + branch_name: ${{ steps.meta.outputs.branch }} |
| 36 | + sha: ${{ steps.meta.outputs.sha }} |
| 37 | + run_id: ${{ steps.meta.outputs.run_id }} |
| 38 | + steps: |
| 39 | + - id: meta |
| 40 | + run: | |
| 41 | + echo "branch=${{ github.event.workflow_run.head_branch }}" >> "$GITHUB_OUTPUT" |
| 42 | + echo "sha=${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT" |
| 43 | + echo "run_id=${{ github.event.workflow_run.id }}" >> "$GITHUB_OUTPUT" |
| 44 | +
|
| 45 | + report-auto-main: |
| 46 | + needs: discover-auto |
| 47 | + if: ${{ needs.discover-auto.outputs.branch_name == 'main' }} |
| 48 | + uses: Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@main |
| 49 | + with: |
| 50 | + test_run_id: ${{ needs.discover-auto.outputs.run_id }} # empty string is fine; shared workflow ignores in auto mode |
| 51 | + secrets: inherit |
| 52 | + |
| 53 | + report-auto-develop: |
| 54 | + needs: discover-auto |
| 55 | + if: ${{ needs.discover-auto.outputs.branch_name == 'develop' }} |
| 56 | + uses: Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@develop |
| 57 | + with: |
| 58 | + test_run_id: ${{ needs.discover-auto.outputs.run_id }} |
| 59 | + secrets: inherit |
| 60 | + |
| 61 | + report-manual-main: |
| 62 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.branch == 'main' }} |
| 63 | + uses: Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@main |
| 64 | + with: |
| 65 | + test_run_id: ${{ inputs.test_run_id }} |
| 66 | + branch: main |
| 67 | + secrets: inherit |
| 68 | + |
| 69 | + report-manual-develop: |
| 70 | + if: ${{ github.event_name == 'workflow_dispatch' && inputs.branch == 'develop' }} |
| 71 | + uses: Stillpoint-Software/shared-workflows/.github/workflows/test-report.yml@develop |
| 72 | + with: |
| 73 | + test_run_id: ${{ inputs.test_run_id }} |
| 74 | + branch: develop |
| 75 | + secrets: inherit |
0 commit comments