From adc65208654727b8e4171626ef8dcc6c34b78b80 Mon Sep 17 00:00:00 2001 From: Adam Stus Date: Mon, 1 Jul 2024 09:51:11 +0200 Subject: [PATCH] Readme update --- .github/workflows/test_integration.yaml | 37 +++++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_integration.yaml b/.github/workflows/test_integration.yaml index 48d5809..8c67bf0 100644 --- a/.github/workflows/test_integration.yaml +++ b/.github/workflows/test_integration.yaml @@ -2,19 +2,44 @@ name: Tests on: pull_request: - branches: - - "*" - push: - branches: - - main + repository_dispatch: + types: [ok-to-test-command] jobs: - tests: + # Branch-based pull request + integration-trusted: runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository steps: + + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Run tests + env: + TEST_SECRET: ${{ secrets.TEST_SECRET }} + run: if [[ -z $TEST_SECRET ]]; then exit 1; else echo "OK"; fi + + + # Repo owner has commented /ok-to-test on a (fork-based) pull request + integration-fork: + runs-on: ubuntu-latest + permissions: + pull-requests: write + checks: write + if: | + github.event_name == 'repository_dispatch' && + github.event.client_payload.slash_command.args.named.sha != '' && + contains( + github.event.client_payload.pull_request.head.sha, + github.event.client_payload.slash_command.args.named.sha + ) + steps: + - uses: actions/checkout@v4 with: persist-credentials: false + ref: 'refs/pull/${{ github.event.client_payload.pull_request.number }}/merge' - name: Run tests env: TEST_SECRET: ${{ secrets.TEST_SECRET }}