Repository navigation
Build the Patchyard website with Kindwall's page inside it #2
Workflow file for this run
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: Branch flow | |
| # Changes flow one way: topic branches → develop → qa → main, and main is what's published. | |
| # Urgent fixes go hotfix/* → main and are merged back. This check fails a pull request aimed at | |
| # the wrong branch. | |
| on: | |
| pull_request: | |
| types: [opened, reopened, edited, synchronize] | |
| permissions: | |
| contents: read | |
| jobs: | |
| direction: | |
| name: Branch flow | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Check the source and target branches | |
| env: | |
| FROM: ${{ github.head_ref }} | |
| TO: ${{ github.base_ref }} | |
| FROM_FORK: ${{ github.event.pull_request.head.repo.full_name != github.repository }} | |
| run: | | |
| refuse() { | |
| echo "::error::A pull request from '$FROM' can't target '$TO'. $1" | |
| exit 1 | |
| } | |
| case "$TO" in | |
| develop) | |
| [ "$FROM_FORK" = "true" ] && exit 0 | |
| case "$FROM" in | |
| feature/* | fix/* | chore/* | docs/* | content/* | dependabot/* | main) exit 0 ;; | |
| *) refuse "Name the branch feature/…, fix/…, chore/…, docs/… or content/…." ;; | |
| esac | |
| ;; | |
| qa) | |
| case "$FROM" in | |
| develop | main) exit 0 ;; | |
| *) refuse "Only develop is promoted to qa (and main, to bring back a hotfix)." ;; | |
| esac | |
| ;; | |
| main) | |
| case "$FROM" in | |
| qa | hotfix/*) exit 0 ;; | |
| *) refuse "Only qa and hotfix/* branches go into main." ;; | |
| esac | |
| ;; | |
| *) | |
| refuse "Open pull requests against develop." | |
| ;; | |
| esac |