Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: CI

# Runs on pull requests (and on demand) only. Each run of the verify job
# waits for a maintainer's approval through the ci-approval environment;
# the "Review deployments" button appears on the pull request itself.
on:
push:
branches:
- main
- dev
- 'dev/**'
pull_request:
branches:
- main
Expand All @@ -20,6 +18,7 @@ permissions:
jobs:
verify:
runs-on: ubuntu-latest
environment: ci-approval

steps:
- name: Checkout
Expand Down Expand Up @@ -48,8 +47,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Require pull requests into main to come from dev
# The branch name is passed through an environment variable rather
# than interpolated into the script, so a crafted branch name cannot
# inject shell commands.
env:
HEAD_REF: ${{ github.head_ref }}
run: |
if [[ "${{ github.head_ref }}" != "dev" && "${{ github.head_ref }}" != dev/* ]]; then
echo "Pull requests into main must originate from 'dev' or a 'dev/**' branch, not '${{ github.head_ref }}'."
if [[ "$HEAD_REF" != "dev" && "$HEAD_REF" != dev/* ]]; then
echo "Pull requests into main must originate from 'dev' or a 'dev/**' branch, not '$HEAD_REF'."
exit 1
fi
Loading