Skip to content

Commit

Permalink
Add test issue_comment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelburnham committed Feb 6, 2024
1 parent 37463d5 commit 696725f
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/issue_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Run integration tests when a maintainer comments `!test` on a PR to feature branch
# Fails when base branch is `main`, as it doesn't support e2e tests
name: End to end integration tests

on:
issue_comment:
types: [created]

jobs:
integration-tests-e2e:
name: E2E verification
runs-on: buildjet-16vcpu-ubuntu-2204
if:
github.event.issue.pull_request
&& github.event.issue.state == 'open'
&& contains(github.event.comment.body, '!test')
&& (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER')
steps:
- uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch

- name: Exit if base branch is `main`
if: ${{ steps.comment-branch.outputs.base_ref == 'main' }}
run: |
echo "Cannot run end2end integration tests on PR targeting `main`"
exit 1
continue-on-error: false

- uses: actions/checkout@v4
with:
submodules: recursive

- name: Checkout PR branch
run: gh pr checkout $PR_NUMBER
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.issue.number }}

- name: Comment on successful run
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.issue.number }}
body: |
End-to-end `!test` action succeeded! :rocket:
https://github.com/lurk-lab/solidity-verifier/actions/runs/${{ github.run_id }}

0 comments on commit 696725f

Please sign in to comment.