Skip to content

Commit

Permalink
feat: make backend action trigger manifest update
Browse files Browse the repository at this point in the history
  • Loading branch information
evanshortiss committed Oct 13, 2023
1 parent 341204d commit e222489
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,35 @@ jobs:
tags: |
quay.io/rhdevelopers/roshambo-backend:latest-camera
quay.io/rhdevelopers/roshambo-backend:sha-${{ steps.git-sha.outputs.sha }}-camera
# https://github.com/orgs/community/discussions/26323#discussioncomment-3251454
# Use the GitHub API to make an authenticated call that triggers a workflow
# in the manifests repository. The targeted workflow opens a PR to use the
# new image that was pushed to quay.io. A personal access token (PAT) is
# required to make the API call. The PAT can be created by a member of the
# redhat-developer-demos org by visiting https://github.com/settings/personal-access-tokens/new
# and selecting "redhat-developer-demos" under resource owner dropdown.
# Select the rps repositories, and then add actions read/write permissions
#
# Set the PAT_TOKEN at https://github.com/redhat-developer-demos/rps-game/settings/secrets/actions
#
# You can manually trigger the action using curl
# curl -X POST \
# -H "Authorization: Bearer $PAT" \
# -H "Accept: application/vnd.github.v3+json" \
# https://api.github.com/repos/redhat-developer-demos/rps-game-manifests/actions/workflows/update-backend-image.yaml/dispatches \
# -d '{"ref":"main", "inputs": { "image": "foo" } }'
- name: Trigger update workflow in the manifests repository
uses: actions/github-script@v6
with:
github-token: ${{ secrets.PAT_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'redhat-developer-demos',
repo: 'rps-game',
workflow_id: 'update-backend-image.yaml',
ref: 'main',
inputs: {
image: 'quay.io/rhdevelopers/roshambo-backend:sha-${{ steps.git-sha.outputs.sha }}'
}
})

0 comments on commit e222489

Please sign in to comment.