Update and rename test-report.yml to create-test-report.yml #344
This file contains hidden or 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
name: Format | |
on: | |
push: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, edited, synchronize, reopened] | |
branches: [main, develop] | |
# Run when Create Prerelease / Create Release start, | |
# **but only if they run on main or develop** | |
workflow_run: | |
workflows: [Create Prerelease, Create Release] | |
types: [requested] | |
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 }}'" | |
format-main: | |
needs: discover | |
if: ${{ needs.discover.outputs.branch_name == 'main' }} | |
uses: Stillpoint-Software/shared-workflows/.github/workflows/format.yml@main | |
with: | |
dotnet_version: "9.0.x" | |
secrets: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
format-develop: | |
needs: discover | |
if: ${{ needs.discover.outputs.branch_name == 'develop' }} | |
uses: Stillpoint-Software/shared-workflows/.github/workflows/format.yml@develop | |
with: | |
dotnet_version: "9.0.x" | |
secrets: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} |