feat: add hk-deployment argocd CMP #68
Workflow file for this run
This file contains hidden or 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: Pull request - Continuous Integration | |
| on: | |
| pull_request: | |
| branches: [main] | |
| # jscpd:ignore-start | |
| permissions: | |
| contents: read | |
| issues: read | |
| packages: write | |
| pull-requests: read | |
| statuses: write | |
| # FIXME: This is a workaround for having workflow actions. See https://github.com/orgs/community/discussions/38659 | |
| id-token: write | |
| # jscpd:ignore-end | |
| jobs: | |
| ci: | |
| name: Continuous Integration | |
| uses: ./.github/workflows/__shared-ci.yml | |
| secrets: | |
| oci-registry-password: ${{ secrets.GITHUB_TOKEN }} | |
| update-pr: | |
| if: ${{ needs.ci.outputs.built-images }} | |
| name: Update Pull Request | |
| runs-on: "ubuntu-latest" | |
| needs: ci | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - id: get-comment-built-images | |
| uses: actions/github-script@v7.0.1 | |
| with: | |
| script: | | |
| const builtImagesOutput = `${{ needs.ci.outputs.built-images }}`; | |
| try { | |
| builtImages = JSON.parse(builtImagesOutput); | |
| } catch (error) { | |
| throw new Error(`"built-images" output is not a valid JSON: ${error}`); | |
| } | |
| if (typeof builtImages !== 'object') { | |
| core.setFailed('Given "built-images" output is not an object.'); | |
| return; | |
| } | |
| const commentMessage = Object.values(builtImages).map(({name,images}) => { | |
| const imagesToPull = images.map(image => `\`\`\`\ndocker pull ${image}\n\`\`\``).join("\n"); | |
| return `### ${name}\n${imagesToPull}`; | |
| }).join("\n"); | |
| if(commentMessage.length){ | |
| core.setOutput( | |
| 'comment-body', | |
| commentMessage + "\n\nOnce the Pull Request gets validated, these(s) image(s) will automatically be deleted." | |
| ); | |
| } else { | |
| core.setOutput('comment-body','No images have been built.'); | |
| } | |
| - uses: hoverkraft-tech/ci-github-common/actions/create-or-update-comment@0.16.0 | |
| with: | |
| title: "Images have been built :sparkles: !" | |
| body: | | |
| ${{ steps.get-comment-built-images.outputs.comment-body }} | |
| reactions: "rocket" |