go-live #10
This file contains 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: 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." | |
schedule: | |
# Run at midnight every day | |
- cron: "0 0 * * *" | |
jobs: | |
go-live: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: "Print manual run reason" | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo 'Reason: ${{ github.event.inputs.reason }}' | |
- name: Create pull request | |
uses: actions/github-script@e69ef5462fd455e02edcaf4dd7708eda96b9eda0 | |
with: | |
retries: 3 | |
script: | | |
// Get the owner and repo from the context | |
const { owner, repo } = context.repo; | |
// Create a pull request from main to live | |
await github.rest.pulls.create({ | |
owner, | |
repo, | |
head: 'main', | |
base: 'live', | |
title: 'Merge `main` into `live`', | |
body: '🤖 Please don\'t squash-merge this PR.', | |
}); |