forked from danskernesdigitalebibliotek/dpl-react
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (50 loc) · 1.99 KB
/
create-cms-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Create CMS PR
on:
workflow_run:
workflows: ["Create release on branch changes"]
types:
- completed
jobs:
invoke-external-pr-workflow:
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: release-info.json
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Set env variables
run: |
RELEASE_BRANCH=$(jq -r '.release_branch' release-info.json)
RELEASE_DOWNLOAD_URL=$(jq -r '.release_download_url' release-info.json)
DEPENDENCY_PACKAGE=$(jq -r '.dependency_package' release-info.json)
echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> $GITHUB_ENV
echo "RELEASE_DOWNLOAD_URL=$RELEASE_DOWNLOAD_URL" >> $GITHUB_ENV
echo "DEPENDENCY_PACKAGE=$DEPENDENCY_PACKAGE" >> $GITHUB_ENV
- name: Invoke external PR workflow
id: invoke_external_pr_workflow
uses: fjogeleit/http-request-action@v1
with:
# TODO: remove hardcoded org/repo
url: 'https://api.github.com/repos/reload/poc-dpl-cms-pr-trigger/dispatches'
method: 'POST'
customHeaders: |
{
"Accept": "application/vnd.github+json",
"Authorization": "Bearer ${{ secrets.CMS_PR_CREATION_PAT }}"
}
data: |
{
"event_type": "create_pr",
"client_payload": {
"branch": "${{ env.RELEASE_BRANCH }}",
"build_url": "${{ env.RELEASE_DOWNLOAD_URL }}",
"dependency_package": "${{ env.DEPENDENCY_PACKAGE }}"
}
}
- name: Adding summary
# TODO: remove hardcoded org/repo
run: |
echo "Requested external PR at: reload/poc-dpl-cms-pr-trigger" >> $GITHUB_STEP_SUMMARY
echo "Based on the ${{ env.RELEASE_BRANCH }} branch" >> $GITHUB_STEP_SUMMARY
if: ${{ steps.invoke_external_pr_workflow.outcome == 'success' }}