diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index bb1d641c..9a369d02 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,19 +1,65 @@ name: Integration Tests on: - workflow_dispatch: push: - branches: [main] + branches: + - main + + workflow_dispatch: + + issue_comment: + types: + - created jobs: integration: name: Live LLM Integration Tests + + if: | + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' || + ( + github.event_name == 'issue_comment' && + github.event.issue.pull_request && + startsWith(github.event.comment.body, '/integration-test') && + ( + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'OWNER' + ) + ) + runs-on: ubuntu-latest + defaults: run: working-directory: ./backend + steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + - name: Get PR details + if: github.event_name == 'issue_comment' + id: pr + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const pr = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + core.setOutput('head_ref', pr.data.head.ref); + core.setOutput('head_repo', pr.data.head.repo.full_name); + + - name: Checkout PR branch + if: github.event_name == 'issue_comment' + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1 + with: + repository: ${{ steps.pr.outputs.head_repo }} + ref: ${{ steps.pr.outputs.head_ref }} + + - name: Checkout repository + if: github.event_name != 'issue_comment' + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 #v4.3.1 - name: Set up Python uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0