-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.48 KB
/
run_tests.yml
File metadata and controls
51 lines (44 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Run Tests
on:
workflow_run:
workflows: [Create Release]
types: [requested]
branches: [main]
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize, reopened]
branches: [main]
permissions:
contents: read
actions: read
jobs:
discover:
runs-on: ubuntu-latest
outputs:
branch_name: ${{ steps.set_branch.outputs.branch_name }}
steps:
- id: set_branch
shell: bash
run: |
# Pick the ref to test for each trigger type.
# For pull_request, test the PR head SHA (the incoming changes),
# not the base branch. Using the SHA is deterministic even if
# the PR branch is later force-pushed.
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
RAW='${{ github.event.workflow_run.head_sha }}'
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
RAW='${{ github.event.pull_request.head.sha }}'
else
RAW='${{ github.ref }}'
fi
# Strip the refs/heads/ prefix if present (only relevant for the push/dispatch fallback)
CLEAN="${RAW#refs/heads/}"
echo "Detected ref: $CLEAN"
echo "branch_name=$CLEAN" >> "$GITHUB_OUTPUT"
test:
needs: discover
uses: Stillpoint-Software/shared-workflows/.github/workflows/run_tests.yml@main
with:
branch: ${{ needs.discover.outputs.branch_name }}
solution_name: ${{ vars.SOLUTION_NAME }}
secrets: inherit