Skip to content

"Everything in one step" approach clashes with workflows where the dev container is treated as one target platform. #481

"Everything in one step" approach clashes with workflows where the dev container is treated as one target platform.

"Everything in one step" approach clashes with workflows where the dev container is treated as one target platform. #481

Workflow file for this run

---
name: pr-bot
# This workflow is triggered on PR comments
on:
issue_comment:
types: [created] # only run on new comments
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issue_comment
permissions:
contents: write
packages: write
jobs:
pr_comment:
name: PR comment
# https://docs.github.com/en/graphql/reference/enums#commentauthorassociation
# (and https://docs.github.com/en/rest/reference/issues#comments)
# only allow commands where:
# - the comment is on a PR
# - the commenting user has write permissions (i.e. is OWNER or COLLABORATOR)
if: ${{ github.event.issue.pull_request }}
runs-on: ubuntu-latest
outputs:
command: ${{ steps.check_command.outputs.command }}
prRef: ${{ steps.check_command.outputs.prRef }}
prNumber: ${{ steps.check_command.outputs.prNumber }}
prHeadSha: ${{ steps.check_command.outputs.prHeadSha }}
steps:
# Ensure we have the script file for the github-script action to use
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
# Determine whether the comment is a command
- id: check_command
name: Check for a command using GitHub script
uses: actions/github-script@v6
with:
script: |
const script = require('./.github/scripts/build.js')
await script.getCommandFromComment({core, context, github});
- name: Output PR details
run: |
echo "PR Details"
echo "=========="
echo "command : ${{ steps.check_command.outputs.command }}"
echo "prNumber : ${{ steps.check_command.outputs.prNumber }}"
echo "prRef : ${{ steps.check_command.outputs.prRef }}"
echo "prHeadSha : ${{ steps.check_command.outputs.prHeadSha }}"
# If we are skipping the tests and don't run the actual deploy (see the run_test job below)
# we won't receive a check-run status, and will have to send it "manually"
- name: Bypass E2E check-runs status
if: ${{ steps.check_command.outputs.command == 'test-force-approve' }}
uses: LouisBrunner/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
# the name must be identical to the one received by the real job
sha: ${{ steps.check_command.outputs.prHeadSha }}
name: "Build, test, publish / All succeeded"
status: "completed"
conclusion: "success"
run_test:
needs: [pr_comment]
if: ${{ needs.pr_comment.outputs.command == 'run-tests' }}
name: build-test
uses: ./.github/workflows/ci_common.yml
with:
prNumber: ${{ needs.pr_comment.outputs.prNumber }}
prRef: ${{ needs.pr_comment.outputs.prRef }}
prHeadSha: ${{ needs.pr_comment.outputs.prHeadSha }}
release: false
secrets:
AZDO_TOKEN: ${{ secrets.AZDO_TOKEN }}