Skip to content

Commit

Permalink
Try to activate create cms pr by workflow dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceo committed May 31, 2024
1 parent 7ab08ed commit 17d285d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/create-cms-pr.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Create CMS PR
on:
workflow_run:
workflows: ["Create release on branch changes"]
types:
- completed
workflow_dispatch:

jobs:
invoke-external-pr-workflow:
Expand Down Expand Up @@ -46,8 +43,17 @@ jobs:
}
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 master
if: ${{ !contains(fromJSON('["develop", "master"]'), env.RELEASE_BRANCH) }}
# Only invoke external PR workflow if the release branch is not develop or main
if: ${{ !contains(fromJSON('["develop", "main"]'), env.RELEASE_BRANCH) }}


# - name: John
# run: |
# gh api -X POST /
# -H 'Accept: application/vnd.github+json' /
# -H 'Authorization: "${{ format('Bearer {0}', secrets.CMS_PR_CREATION_PAT) }}"' /
# ${{ format('/repos/{0}/dispatches', vars.REMOTE_REPO_GITHUB_HANDLE) }}


- name: Adding summary
run: |
Expand All @@ -57,9 +63,9 @@ jobs:
env:
BRANCH_URL: "${{ github.event.repository.html_url }}/tree/${{ env.RELEASE_BRANCH }}"
REMOTE_REPO_GITHUB_HANDLE: "${{ vars.REMOTE_REPO_GITHUB_HANDLE }}"
- name: Adding summary about skip if branch is develop or master
# TODO: remove hardcoded org/repo

- 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", "master"]'), env.RELEASE_BRANCH) }}
if: ${{ contains(fromJSON('["develop", "main"]'), env.RELEASE_BRANCH) }}
18 changes: 9 additions & 9 deletions .github/workflows/create-release-on-branch-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ jobs:
body: ${{ env.RELEASE_DESCRIPTION }}
files: ${{ env.DIST_FILENAME }}

- name: Write release information in artifact file
run: |
printf '{
"release_branch": "${{ env.RELEASE_BRANCH }}",
"dependency_package": "danskernesdigitalebibliotek/dpl-design-system",
"release_download_url": "${{ env.DOWNLOAD_URL }}"
}' >> release-info.json
env:
DOWNLOAD_URL: "${{ github.event.repository.html_url }}/releases/download/${{ env.TAG_NAME }}/${{ env.DIST_FILENAME }}"
# - name: Write release information in artifact file
# run: |
# printf '{
# "release_branch": "${{ env.RELEASE_BRANCH }}",
# "dependency_package": "danskernesdigitalebibliotek/dpl-design-system",
# "release_download_url": "${{ env.DOWNLOAD_URL }}"
# }' >> release-info.json
# env:
# DOWNLOAD_URL: "${{ github.event.repository.html_url }}/releases/download/${{ env.TAG_NAME }}/${{ env.DIST_FILENAME }}"

- uses: actions/upload-artifact@v3
with:
Expand Down

0 comments on commit 17d285d

Please sign in to comment.