Create CMS PR #14
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: Create CMS PR | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseBranch: | |
description: 'Release Branch' | |
required: true | |
releaseDownloadUrl: | |
description: 'Release Download Url' | |
required: true | |
dependencyPackage: | |
description: 'Dependency Package' | |
required: true | |
jobs: | |
invoke-external-pr-workflow: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Invoke external PR workflow | |
id: invoke_external_pr_workflow | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: ${{ env.REQUEST_URL}} | |
method: 'POST' | |
customHeaders: | | |
{ | |
"Accept": "application/vnd.github+json", | |
"Authorization": "Bearer ${{ secrets.CMS_PR_CREATION_PAT }}" | |
} | |
data: | | |
{ | |
"event_type": "create_pr", | |
"client_payload": { | |
"branch": "${{ inputs.releaseBranch }}", | |
"build_url": "${{ inputs.releaseDownloadUrl }}", | |
"dependency_package": "${{ inputs.dependencyPackage }}" | |
} | |
} | |
env: | |
REQUEST_URL: ${{ format('https://api.github.com/repos/{0}/dispatches', vars.REMOTE_REPO_GITHUB_HANDLE) }} | |
# Only invoke external PR workflow if the release branch is not develop or main | |
if: ${{ !contains(fromJSON('["develop", "main"]'), inputs.releaseBranch) }} | |
- name: Adding summary | |
run: | | |
echo "Requested external PR at: ${REMOTE_REPO_GITHUB_HANDLE}" >> $GITHUB_STEP_SUMMARY | |
echo "Based on the [${{ inputs.releaseBranch }}](${{ env.BRANCH_URL }}) branch" >> $GITHUB_STEP_SUMMARY | |
if: ${{ steps.invoke_external_pr_workflow.outcome == 'success' }} | |
env: | |
BRANCH_URL: "${{ github.event.repository.html_url }}/tree/${{ inputs.releaseBranch }}" | |
REMOTE_REPO_GITHUB_HANDLE: "${{ vars.REMOTE_REPO_GITHUB_HANDLE }}" | |
- name: Adding summary about skip if branch is develop or main | |
run: | | |
echo "Skipped PR creation because the branch was: $RELEASE_BRANCH " >> $GITHUB_STEP_SUMMARY | |
echo "...which is not considered being a release branch. " >> $GITHUB_STEP_SUMMARY | |
if: ${{ contains(fromJSON('["develop", "main"]'), inputs.releaseBranch) }} |