Skip to content

hotfix(staging): cherry-pick 7248c287 #19

hotfix(staging): cherry-pick 7248c287

hotfix(staging): cherry-pick 7248c287 #19

name: env-branch-gate
# Satisfies the required `env-branch-gate` status check on hotfix pull requests
# into env/** branches so GitHub auto-merge fires. The hotfix apply job opens its
# pull request with a token capable of triggering downstream workflows, so the
# pull request event fires here directly. This job posts a success status onto
# the pull request head commit. Branch protection matches that status by context
# name on the head SHA, and auto-merge re-evaluates and merges.
on:
pull_request:
branches:
- 'env/**'
permissions:
contents: read
pull-requests: read
statuses: write
jobs:
gate:
runs-on: ubuntu-latest
steps:
- name: Post gate status on the hotfix pull request head
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
NUMBER: ${{ github.event.pull_request.number }}
SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
# The hotfix apply job opens a pull request into an env/** branch and
# enables auto-merge. Post the gate status onto the pull request head so
# the required check turns green and auto-merge proceeds.
echo "posting env-branch-gate success on PR #${NUMBER} head ${SHA}"
gh api -X POST "repos/${REPO}/statuses/${SHA}" \
-f state=success \
-f context=env-branch-gate \
-f description="env-branch PR gate ok"