Skip to content

go-live

go-live #10

name: go-live
on:
workflow_dispatch:
inputs:
reason:
description: "The reason for running the workflow"
required: true
default: "Need to update live now, before daily scheduled run."
permissions:
contents: read
jobs:
go-live:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: write
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: "Print manual run reason"
if: github.event_name == 'workflow_dispatch'
run: |
echo 'Reason: ${{ github.event.inputs.reason }}'
- name: Check out code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # main
- name: Check for existing PR
id: exists
run: |
result=$(gh pr list --base live --head main --json number --jq '.[0].number' || echo "")
echo "PR_NUMBER=$result" >> $GITHUB_OUTPUT
shell: bash
- name: Create pull request
id: create
if: steps.exists.outputs.PR_NUMBER == ''
run: |
gh pr create \
--title "✅ Merge \`main\` into \`live\`" \
--body "🤖 Queue merge when ready..." \
--base live \
--head main
echo "CREATED=true" >> $GITHUB_OUTPUT
- name: Enable auto-merge for the pull request
if: steps.create.outputs.CREATED == 'true'
run: |
PR_NUMBER=$(gh pr list --base live --head main --json number --jq '.[0].number')
gh pr merge $PR_NUMBER --merge --auto