Skip to content

Test

Test #176

Workflow file for this run

name: Test
on:
workflow_run:
workflows: [Create Prerelease, Create Release]
types: [requested]
branches: [main, develop]
workflow_dispatch:
pull_request:
types: [opened, edited, synchronize, reopened]
branches: [main, develop]
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: |
# 1. Pick the raw branch/ref for each trigger type
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
RAW='${{ github.event.workflow_run.head_branch }}'
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
RAW='${{ github.event.pull_request.base.ref }}'
else
RAW='${{ github.ref }}'
fi
# 2. Strip the refs/heads/ prefix if present
CLEAN="${RAW#refs/heads/}"
echo "Detected branch: $CLEAN"
echo "branch_name=$CLEAN" >> "$GITHUB_OUTPUT"
show-branch:
needs: discover
runs-on: ubuntu-latest
steps:
- name: Print branch_name from discover
run: |
echo "::notice title=branch_name::'${{ needs.discover.outputs.branch_name }}'"
test-main:
needs: discover
if: ${{ needs.discover.outputs.branch_name == 'main' }}
uses: Stillpoint-Software/shared-workflows/.github/workflows/test.yml@main
with:
solution_name: ${{ vars.SOLUTION_NAME }}
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-develop:
needs: discover
if: ${{ needs.discover.outputs.branch_name == 'develop' }}
uses: Stillpoint-Software/shared-workflows/.github/workflows/test.yml@develop
with:
solution_name: ${{ vars.SOLUTION_NAME }}
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}