🚀 Initiate Publish #2
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: 🚀 Initiate Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to merge into main' | |
required: true | |
default: 'develop' | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
initiate_publish: | |
name: 🚀 Initiate Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ env.GITHUB_TOKEN }} | |
fetch-depth: 0 | |
- name: 🔄 Merge develop into main | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.repos.merge({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
base: 'main', | |
head: '${{ github.event.inputs.branch }}', | |
}); | |
# Push from Action does not trigger subsequent action | |
# https://github.com/orgs/community/discussions/25702 | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch | |
- name: 🔄 Trigger Publish Workflow | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.repos.createDispatchEvent({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
event_type: 'publish-trigger', | |
client_payload: {} | |
}); |