Merge pull request #70 from Stillpoint-Software/develop #602
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] | |
workflow_run: | |
workflows: [Create Prerelease, Create Release] | |
types: [requested] | |
permissions: | |
contents: write | |
pull-requests: write | |
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" | |
format: | |
needs: discover | |
if: ${{ needs.discover.result == 'success' }} | |
uses: Stillpoint-Software/shared-workflows/.github/workflows/format.yml@main | |
with: | |
dotnet_version: "9.0.x" | |
branch: ${{ needs.discover.outputs.branch_name }} | |
secrets: inherit | |