Skip to content

Commit

Permalink
create manually dispatched workflow for testing (wpengine#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
apmatthews authored Dec 17, 2021
1 parent b43d713 commit 1c2b88a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/actions/post-release/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
async function mergeToMain({github, context}) {
console.log("TEST: Merging canary to main...");

const result = await github.rest.repos.merge({
...context.repo,
base: "TEST_main",
head: "TEST_canary",
commit_message: "TEST: Merge release from branch `canary` into `main`"
});

return result;
}

module.exports = {
mergeToMain
}
37 changes: 37 additions & 0 deletions .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Post-release jobs

on:
workflow_dispatch:
inputs:
published:
description: "Simulates whether changesets did or did not publish a release."
required: true
default: "false"

jobs:
simulate_output:
name: "Simulate changesets/action output"
runs-on: ubuntu-latest
outputs:
published: ${{ steps.step1.outputs.published }}
steps:
- id: step1
run: echo "::set-output name=published::${{ github.event.inputs.published }}"
merge_to_main:
name: "Merge `canary` into `main`"
runs-on: ubuntu-latest
needs: simulate_output
if: ${{ needs.simulate_output.outputs.published == 'true' }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Merge to main
uses: actions/github-script@v5
with:
script: |
const { mergeToMain } = require('.github/actions/post-release/index.js')
return await mergeToMain({github, context})

0 comments on commit 1c2b88a

Please sign in to comment.