Skip to content

CCAP-304: Deploy worker for the Document Transfer service #11

CCAP-304: Deploy worker for the Document Transfer service

CCAP-304: Deploy worker for the Document Transfer service #11

Workflow file for this run

name: Pull request checks
on:
pull_request:
jobs:
plan:
uses: ./.github/workflows/plan.yaml
with:
# TODO: Get the environments to plan on from the diff.
environment: staging
config: staging
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
comment:
runs-on: ubuntu-latest
needs: plan
steps:
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Retrieve existing bot comments for the pull request.
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
})
const botComment = comments.find(comment => {
return comment.user.type === 'Bot' && comment.body.includes('## Plan output')
})
// Prepare the format of the comment.
const output = `## Plan output\n\n\`\`\`\n${{ needs.plan.outputs.plan }}\n\`\`\``
// If we have a comment, update it. Otherwise, create a new one.
if (botComment) {
github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: output
})
} else {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
}