diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml new file mode 100644 index 0000000000..98869d1c93 --- /dev/null +++ b/.github/workflows/run-integration-tests.yml @@ -0,0 +1,114 @@ +name: Run Integration Tests + +on: + issue_comment: + types: [created, edited] + pull_request: + types: [opened, synchronize, reopened] + +jobs: + run-integration-tests: + name: Run Integration Tests + runs-on: ubuntu-latest + if: | + (github.event_name == 'issue_comment' && + contains(github.event.comment.body, '/integration-test') && + github.event.issue.pull_request) || + (github.event_name == 'pull_request' && + contains(github.event.pull_request.body, '/integration-test')) + steps: + - name: Print debugging info + run: | + cat <> $GITHUB_OUTPUT + + echo "Waiting for completion" + gh run watch $RUN_ID \ + --repo fivetran/sqlglot-integration-tests \ + --interval 10 \ + --compact \ + --exit-status + + - name: Fetch outputs + uses: actions/download-artifact@v5 + with: + github-token: ${{ steps.app-token.outputs.token }} + repository: fivetran/sqlglot-integration-tests + run-id: ${{ steps.run-remote.outputs.remote_run_id }} + name: summary + + - name: Write summary as comment + uses: actions/github-script@v8 + # only do this when on PR branches, main builds dont have anywhere to write comments + if: ${{ github.event_name == 'pull_request' }} + with: + script: | + // summary.json is downloaded from the remote workflow in the previous step + const summary = require("./summary.json") + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: summary.msg + })