From 815fe3bf84e029216ad25c9cba0827109d43fb2a Mon Sep 17 00:00:00 2001 From: Ming Wang Date: Wed, 26 Jul 2023 15:51:53 -0400 Subject: [PATCH] build_test --- .github/workflows/pr-command.yml | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/pr-command.yml diff --git a/.github/workflows/pr-command.yml b/.github/workflows/pr-command.yml new file mode 100644 index 0000000000..77cc2e321a --- /dev/null +++ b/.github/workflows/pr-command.yml @@ -0,0 +1,48 @@ +name: PR Command + +concurrency: + group: ci-${{ github.run_id }} + cancel-in-progress: true + +on: + issue_comment: + types: [created] + +jobs: + build-and-test: + runs-on: ubuntu-latest + if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/build_test') }} + steps: + - name: Set latest commit status as pending + uses: myrotvorets/set-commit-status-action@master + with: + sha: ${{ steps.comment-branch.outputs.head_sha }} + token: ${{ secrets.GITHUB_TOKEN }} + status: pending + - name: Command handler for building and testing + id: command + uses: xt0rted/slash-command-action@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + command: build_test + reaction: "true" + reaction-type: "+1" + allow-edits: "false" + permission-level: write + - name: Build image + id: build-image + uses: ./.github/workflows/ci-build-image.yml + secrets: inherit + with: + build-arch: amd64 + - name: Print the image + uses: thollander/actions-comment-pull-request@v1 + with: + message: |- + Preview image available: + - name: Set latest commit status as ${{ job.status }} + uses: myrotvorets/set-commit-status-action@master + with: + sha: ${{ steps.comment-branch.outputs.head_sha }} + token: ${{ secrets.GITHUB_TOKEN }} + status: ${{ job.status }} \ No newline at end of file