diff --git a/.github/workflows/integration-comment.yml b/.github/workflows/ci-integration-review.yml similarity index 52% rename from .github/workflows/integration-comment.yml rename to .github/workflows/ci-integration-review.yml index fd24d07f94b90..ba651e6e3e282 100644 --- a/.github/workflows/integration-comment.yml +++ b/.github/workflows/ci-integration-review.yml @@ -1,4 +1,4 @@ -# Integration Test Comment +# Integration CI Review Trigger # # This workflow runs one or more integration tests triggered by a comment in a PR. # The comment must include '/ci-run-integration'. @@ -22,12 +22,15 @@ # 4. Run all CI (including all integration tests) # # /ci-run-all +# +# NOTE: This workflow runs on Pull Request Review Comments rather than normal comments to be able to +# capture the SHA that the comment is associated with. -name: Integration Test Comment +name: CI Integration Review Trigger on: - issue_comment: - types: [created] + pull_request_review: + types: [submitted] env: AWS_ACCESS_KEY_ID: "dummy" @@ -46,10 +49,10 @@ env: jobs: prep-pr: - name: (PR comment) Signal pending to PR + name: (PR review) Signal pending to PR runs-on: ubuntu-latest timeout-minutes: 5 - if: contains(github.event.comment.body, '/ci-run-integration') || contains(github.event.comment.body, '/ci-run-all') + if: startsWith(github.event.review.body, '/ci-run-integration') || contains(github.event.review.body, '/ci-run-all') steps: - name: Generate authentication token id: generate_token @@ -57,14 +60,7 @@ jobs: with: app_id: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }} private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }} - - name: Get PR author - id: pr - uses: tspascoal/get-user-teams-membership@v3 - with: - username: ${{ github.event.issue.user.login }} - team: 'Vector' - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - - name: Get PR comment author + - name: Get PR review author id: comment uses: tspascoal/get-user-teams-membership@v3 with: @@ -73,17 +69,13 @@ jobs: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - name: Validate author membership - if: steps.pr.outputs.isTeamMember == 'false' || steps.comment.outputs.isTeamMember == 'false' + if: steps.comment.outputs.isTeamMember == 'false' run: exit 1 - - name: (PR comment) Get PR branch - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending + - name: (PR review) Set latest commit status as pending uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} status: pending @@ -95,15 +87,16 @@ jobs: - uses: actions/checkout@v3 with: submodules: "recursive" + ref: ${{ github.events.review.commit_id }} - run: sudo npm -g install @datadog/datadog-ci - run: docker image prune -af ; docker container prune -f - name: amqp - if: ${{ contains(github.event.comment.body, '/ci-run-integration-amqp') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-amqp') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: # First one requires more time, as we need to build the image from scratch @@ -112,9 +105,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int amqp - name: appsignal - if: ${{ contains(github.event.comment.body, '/ci-run-integration-appsignal') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-appsignal') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -122,9 +115,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int appsignal - name: aws - if: ${{ contains(github.event.comment.body, '/ci-run-integration-aws') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-aws') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -132,9 +125,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int aws - name: axiom - if: ${{ contains(github.event.comment.body, '/ci-run-integration-axiom') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-axiom') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -142,9 +135,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int axiom - name: azure - if: ${{ contains(github.event.comment.body, '/ci-run-integration-azure') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-azure') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -152,9 +145,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int azure - name: clickhouse - if: ${{ contains(github.event.comment.body, '/ci-run-integration-clickhouse') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-clickhouse') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -162,9 +155,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int clickhouse - name: databend - if: ${{ contains(github.event.comment.body, '/ci-run-integration-databend') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-databend') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -172,9 +165,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int databend - name: datadog-agent - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-agent') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-datadog-agent') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -182,9 +175,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int datadog-agent - name: datadog-logs - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-logs') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-datadog-logs') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -192,9 +185,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int datadog-logs - name: datadog-metrics - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-metrics') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-datadog-metrics') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -202,9 +195,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int datadog-metrics - name: datadog-traces - if: ${{ contains(github.event.comment.body, '/ci-run-integration-datadog-traces') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-datadog-traces') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -212,9 +205,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int datadog-traces - name: dnstap - if: ${{ contains(github.event.comment.body, '/ci-run-integration-dnstap') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-dnstap') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -224,9 +217,9 @@ jobs: - run: docker image prune -af --filter=label!=vector-test-runner=true ; docker container prune -f - name: docker-logs - if: ${{ contains(github.event.comment.body, '/ci-run-integration-docker-logs') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-docker-logs') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -234,9 +227,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int docker-logs - name: elasticsearch - if: ${{ contains(github.event.comment.body, '/ci-run-integration-elasticsearch') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-elasticsearch') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -244,9 +237,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int elasticsearch - name: eventstoredb - if: ${{ contains(github.event.comment.body, '/ci-run-integration-eventstoredb') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-eventstoredb') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -254,9 +247,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int eventstoredb - name: fluent - if: ${{ contains(github.event.comment.body, '/ci-run-integration-fluent') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-fluent') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -264,9 +257,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int fluent - name: gcp - if: ${{ contains(github.event.comment.body, '/ci-run-integration-gcp') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-gcp') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -274,9 +267,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int gcp - name: greptimedb - if: ${{ contains(github.event.comment.body, '/ci-run-integration-greptimedb') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-greptimedb') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -284,9 +277,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int greptimedb - name: humio - if: ${{ contains(github.event.comment.body, '/ci-run-integration-humio') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-humio') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -294,9 +287,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int humio - name: http-client - if: ${{ contains(github.event.comment.body, '/ci-run-integration-http-client') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-http-client') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -304,9 +297,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int http-client - name: influxdb - if: ${{ contains(github.event.comment.body, '/ci-run-integration-influxdb') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-influxdb') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -314,9 +307,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int influxdb - name: kafka - if: ${{ contains(github.event.comment.body, '/ci-run-integration-kafka') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-kafka') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -324,9 +317,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int kafka - name: logstash - if: ${{ contains(github.event.comment.body, '/ci-run-integration-logstash') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-logstash') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -334,9 +327,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int logstash - name: loki - if: ${{ contains(github.event.comment.body, '/ci-run-integration-loki') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-loki') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -344,9 +337,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int loki - name: mongodb - if: ${{ contains(github.event.comment.body, '/ci-run-integration-mongodb') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-mongodb') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -354,9 +347,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int mongodb - name: mqtt - if: ${{ contains(github.event.comment.body, '/ci-run-integration-mqtt') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-mqtt') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -366,9 +359,9 @@ jobs: - run: docker image prune -af --filter=label!=vector-test-runner=true ; docker container prune -f - name: nats - if: ${{ contains(github.event.comment.body, '/ci-run-integration-nats') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-nats') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -376,9 +369,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int nats - name: nginx - if: ${{ contains(github.event.comment.body, '/ci-run-integration-nginx') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-nginx') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -386,9 +379,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int nginx - name: opentelemetry - if: ${{ contains(github.event.comment.body, '/ci-run-integration-opentelemetry') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-opentelemetry') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -396,9 +389,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int opentelemetry - name: postgres - if: ${{ contains(github.event.comment.body, '/ci-run-integration-postgres') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-postgres') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -406,9 +399,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int postgres - name: prometheus - if: ${{ contains(github.event.comment.body, '/ci-run-integration-prometheus') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-prometheus') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -416,9 +409,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int prometheus - name: pulsar - if: ${{ contains(github.event.comment.body, '/ci-run-integration-pulsar') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-pulsar') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -426,9 +419,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int pulsar - name: redis - if: ${{ contains(github.event.comment.body, '/ci-run-integration-redis') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-redis') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -436,9 +429,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int redis - name: shutdown - if: ${{ contains(github.event.comment.body, '/ci-run-integration-shutdown') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-shutdown') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -446,9 +439,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int shutdown - name: splunk - if: ${{ contains(github.event.comment.body, '/ci-run-integration-splunk') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-splunk') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -456,9 +449,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh int splunk - name: webhdfs - if: ${{ contains(github.event.comment.body, '/ci-run-integration-webhdfs') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-integration-webhdfs') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 30 @@ -473,14 +466,15 @@ jobs: - uses: actions/checkout@v3 with: submodules: "recursive" + ref: ${{ github.events.review.commit_id }} - run: sudo npm -g install @datadog/datadog-ci - run: docker image prune -af ; docker container prune -f - name: e2e-datadog-logs - if: ${{ contains(github.event.comment.body, '/ci-run-e2e-datadog-logs') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-e2e-datadog-logs') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 35 @@ -488,9 +482,9 @@ jobs: command: bash scripts/ci-int-e2e-test.sh e2e datadog-logs - name: datadog-e2e-metrics - if: ${{ contains(github.event.comment.body, '/ci-run-e2e-datadog-metrics') - || contains(github.event.comment.body, '/ci-run-integration-all') - || contains(github.event.comment.body, '/ci-run-all') }} + if: ${{ startsWith(github.event.review.body, '/ci-run-e2e-datadog-metrics') + || startsWith(github.event.review.body, '/ci-run-integration-all') + || startsWith(github.event.review.body, '/ci-run-all') }} uses: nick-fields/retry@v3 with: timeout_minutes: 35 @@ -504,7 +498,7 @@ jobs: needs: - integration-tests - e2e-tests - if: always() && (contains(github.event.comment.body, '/ci-run-integration') || contains(github.event.comment.body, '/ci-run-all')) + if: always() && (startsWith(github.event.review.body, '/ci-run-integration') || contains(github.event.review.body, '/ci-run-all')) env: FAILED: ${{ contains(needs.*.result, 'failure') }} steps: @@ -516,23 +510,18 @@ jobs: private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }} - name: Validate issue comment - if: github.event_name == 'issue_comment' + if: github.event_name == 'pull_request_review' uses: tspascoal/get-user-teams-membership@v3 with: username: ${{ github.actor }} team: 'Vector' GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - - name: (PR comment) Get PR branch - if: github.event_name == 'issue_comment' && env.FAILED != 'true' - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Submit PR result as success - if: github.event_name == 'issue_comment' && env.FAILED != 'true' + - name: (PR review) Submit PR result as success + if: github.event_name == 'pull_request_review' && env.FAILED != 'true' uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} status: 'success' diff --git a/.github/workflows/comment-trigger.yml b/.github/workflows/ci-review-trigger.yml similarity index 56% rename from .github/workflows/comment-trigger.yml rename to .github/workflows/ci-review-trigger.yml index 30494bf8e5dbb..04536d63af9a7 100644 --- a/.github/workflows/comment-trigger.yml +++ b/.github/workflows/ci-review-trigger.yml @@ -1,9 +1,12 @@ -# Comment Trigger +# CI Review Trigger # # This workflow is a central point for triggering workflow runs that normally run only as part of the merge queue, # on demand by a comment. The exception being the integration tests, which have their own workflow file for # comment triggers as the logic is a bit more complex. # +# NOTE: This workflow runs on Pull Request Review Comments rather than normal comments to be able to +# capture the SHA that the comment is associated with. +# # The available triggers are: # # /ci-run-all : runs all of the below @@ -18,11 +21,11 @@ # /ci-run-regression : runs Regression Detection Suite # /ci-run-k8s : runs K8s E2E Suite -name: Comment Trigger +name: CI Review Trigger on: - issue_comment: - types: [created] + pull_request_review: + types: [submitted] env: DD_ENV: "ci" @@ -37,30 +40,30 @@ env: # The below concurrency group settings would let us cancel in progress runs that were triggered with the # same comment on a given PR, which could save on time consuming runs. -# But GH does not currently support the github.event.comment.body as part of the concurrency name, this +# But GH does not currently support the github.event.review.body as part of the concurrency name, this # appears to be due to the potential length of it. #concurrency: -# group: ${{ github.workflow }}-${{ github.event.issue.id }}-${{ github.event.comment.body }} +# group: ${{ github.workflow }}-${{ github.event.issue.id }}-${{ github.event.review.body }} # cancel-in-progress: true jobs: validate: - name: Validate comment + name: Validate review runs-on: ubuntu-latest timeout-minutes: 5 if: | github.event.issue.pull_request && ( - contains(github.event.comment.body, '/ci-run-all') - || contains(github.event.comment.body, '/ci-run-cli') - || contains(github.event.comment.body, '/ci-run-misc') - || contains(github.event.comment.body, '/ci-run-deny') - || contains(github.event.comment.body, '/ci-run-component-features') - || contains(github.event.comment.body, '/ci-run-cross') - || contains(github.event.comment.body, '/ci-run-unit-mac') - || contains(github.event.comment.body, '/ci-run-unit-windows') - || contains(github.event.comment.body, '/ci-run-environment') - || contains(github.event.comment.body, '/ci-run-regression') - || contains(github.event.comment.body, '/ci-run-k8s') + startsWith(github.event.review.body, '/ci-run-all') + || startsWith(github.event.review.body, '/ci-run-cli') + || startsWith(github.event.review.body, '/ci-run-misc') + || startsWith(github.event.review.body, '/ci-run-deny') + || startsWith(github.event.review.body, '/ci-run-component-features') + || startsWith(github.event.review.body, '/ci-run-cross') + || startsWith(github.event.review.body, '/ci-run-unit-mac') + || startsWith(github.event.review.body, '/ci-run-unit-windows') + || startsWith(github.event.review.body, '/ci-run-environment') + || startsWith(github.event.review.body, '/ci-run-regression') + || startsWith(github.event.review.body, '/ci-run-k8s') ) steps: - name: Generate authentication token @@ -69,14 +72,7 @@ jobs: with: app_id: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }} private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }} - - name: Get PR author - id: pr - uses: tspascoal/get-user-teams-membership@v3 - with: - username: ${{ github.event.issue.user.login }} - team: 'Vector' - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - - name: Get PR comment author + - name: Get PR review author id: comment uses: tspascoal/get-user-teams-membership@v3 with: @@ -85,65 +81,65 @@ jobs: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - name: Validate author membership - if: steps.pr.outputs.isTeamMember == 'false' || steps.comment.outputs.isTeamMember == 'false' + if: steps.comment.outputs.isTeamMember == 'false' run: exit 1 cli: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-cli') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-cli') uses: ./.github/workflows/cli.yml secrets: inherit misc: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-misc') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-misc') uses: ./.github/workflows/misc.yml secrets: inherit deny: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-deny') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-deny') uses: ./.github/workflows/deny.yml secrets: inherit component-features: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-component-features') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-component-features') uses: ./.github/workflows/component_features.yml secrets: inherit cross: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-cross') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-cross') uses: ./.github/workflows/cross.yml secrets: inherit unit-mac: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-unit-mac') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-unit-mac') uses: ./.github/workflows/unit_mac.yml secrets: inherit unit-windows: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-unit-windows') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-unit-windows') uses: ./.github/workflows/unit_windows.yml secrets: inherit environment: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-environment') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-environment') uses: ./.github/workflows/environment.yml secrets: inherit regression: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-regression') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-regression') uses: ./.github/workflows/regression.yml secrets: inherit k8s: needs: validate - if: contains(github.event.comment.body, '/ci-run-all') || contains(github.event.comment.body, '/ci-run-k8s') + if: startsWith(github.event.review.body, '/ci-run-all') || contains(github.event.review.body, '/ci-run-k8s') uses: ./.github/workflows/k8s_e2e.yml secrets: inherit diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 0ac6fb3070e02..5374296d1d35e 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -10,28 +10,23 @@ jobs: env: CARGO_INCREMENTAL: 0 steps: - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: CLI - Linux status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout review SHA + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - name: Cache Cargo registry + index @@ -54,11 +49,11 @@ jobs: run: scripts/upload-test-results.sh if: always() - - name: (PR comment) Set latest commit status as ${{ job.status }} + - name: (PR review) Set latest commit status as ${{ job.status }} uses: myrotvorets/set-commit-status-action@v2.0.1 - if: always() && github.event_name == 'issue_comment' + if: always() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: CLI - Linux status: ${{ job.status }} diff --git a/.github/workflows/component_features.yml b/.github/workflows/component_features.yml index a1eb17e106342..6c7fc5a830eab 100644 --- a/.github/workflows/component_features.yml +++ b/.github/workflows/component_features.yml @@ -4,7 +4,7 @@ # # Runs on: # - scheduled UTC midnight Tues-Sat -# - on PR comment (see comment-trigger.yml) +# - on PR review (see comment-trigger.yml) # - on demand from github actions UI name: Component Features - Linux @@ -20,30 +20,25 @@ jobs: check-component-features: # use free tier on schedule and 8 core to expedite results on demand invocation runs-on: ${{ github.event_name == 'schedule' && 'ubuntu-latest' || 'ubuntu-20.04-8core' }} - if: github.event_name == 'issue_comment' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' + if: github.event_name == 'pull_request_review' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' steps: - - name: (PR comment) Get PR branch - if: github.event_name == 'issue_comment' - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: github.event_name == 'issue_comment' + - name: (PR review) Set latest commit status as pending + if: github.event_name == 'pull_request_review' uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Component Features - Linux status: pending - - name: (PR comment) Checkout PR branch - if: github.event_name == 'issue_comment' + - name: (PR review) Checkout PR branch + if: github.event_name == 'pull_request_review' uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: github.event_name != 'issue_comment' + if: github.event_name != 'pull_request_review' uses: actions/checkout@v3 - run: sudo -E bash scripts/environment/bootstrap-ubuntu-20.04.sh @@ -51,11 +46,11 @@ jobs: - run: echo "::add-matcher::.github/matchers/rust.json" - run: make check-component-features - - name: (PR comment) Set latest commit status as ${{ job.status }} - if: always() && github.event_name == 'issue_comment' + - name: (PR review) Set latest commit status as ${{ job.status }} + if: always() && github.event_name == 'pull_request_review' uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Component Features - Linux status: ${{ job.status }} diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml index ca1d49a02f8fa..87ba03254f5cc 100644 --- a/.github/workflows/cross.yml +++ b/.github/workflows/cross.yml @@ -22,29 +22,23 @@ jobs: - arm-unknown-linux-gnueabi - arm-unknown-linux-musleabi steps: - - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Cross status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - uses: actions/cache@v4 @@ -70,9 +64,9 @@ jobs: name: "vector-debug-${{ matrix.target }}" path: "./target/${{ matrix.target }}/debug/vector" - - name: (PR comment) Set latest commit status as failed + - name: (PR review) Set latest commit status as failed uses: myrotvorets/set-commit-status-action@v2.0.1 - if: failure() && github.event_name == 'issue_comment' + if: failure() && github.event_name == 'pull_request_review' with: sha: ${{ steps.comment-branch.outputs.head_sha }} token: ${{ secrets.GITHUB_TOKEN }} @@ -80,20 +74,16 @@ jobs: status: 'failure' update-pr-status: - name: (PR comment) Signal result to PR + name: (PR review) Signal result to PR runs-on: ubuntu-20.04 timeout-minutes: 5 needs: cross-linux - if: needs.cross-linux.result == 'success' && github.event_name == 'issue_comment' + if: needs.cross-linux.result == 'success' && github.event_name == 'pull_request_review' steps: - - name: (PR comment) Get PR branch - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Submit PR result as success + - name: (PR review) Submit PR result as success uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Cross status: 'success' diff --git a/.github/workflows/deny.yml b/.github/workflows/deny.yml index d3cbc15304e20..3ab5e6199b293 100644 --- a/.github/workflows/deny.yml +++ b/.github/workflows/deny.yml @@ -4,7 +4,7 @@ # # Runs on: # - scheduled UTC midnight -# - on PR comment (see comment-trigger.yml) +# - on PR review (see comment-trigger.yml) # - on demand from github actions UI name: Deny - Linux @@ -23,28 +23,23 @@ jobs: env: CARGO_INCREMENTAL: 0 steps: - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Deny - Linux status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - uses: actions/cache@v4 @@ -65,11 +60,11 @@ jobs: - name: Check cargo deny advisories/licenses run: make check-deny - - name: (PR comment) Set latest commit status as ${{ job.status }} + - name: (PR review) Set latest commit status as ${{ job.status }} uses: myrotvorets/set-commit-status-action@v2.0.1 - if: always() && github.event_name == 'issue_comment' + if: always() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Deny - Linux status: ${{ job.status }} diff --git a/.github/workflows/environment.yml b/.github/workflows/environment.yml index 93c5d763d7c4b..d1b4c84732fa6 100644 --- a/.github/workflows/environment.yml +++ b/.github/workflows/environment.yml @@ -16,28 +16,23 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 30 steps: - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Environment Suite status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - name: Set up QEMU @@ -72,11 +67,11 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - name: (PR comment) Set latest commit status as ${{ job.status }} + - name: (PR review) Set latest commit status as ${{ job.status }} uses: myrotvorets/set-commit-status-action@v2.0.1 - if: always() && github.event_name == 'issue_comment' + if: always() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Environment Suite status: ${{ job.status }} diff --git a/.github/workflows/k8s_e2e.yml b/.github/workflows/k8s_e2e.yml index 53cd98d0a3140..35acfdad4bf5f 100644 --- a/.github/workflows/k8s_e2e.yml +++ b/.github/workflows/k8s_e2e.yml @@ -70,27 +70,22 @@ jobs: CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 256 CARGO_INCREMENTAL: 0 steps: - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - uses: actions/cache@v4 @@ -110,11 +105,11 @@ jobs: name: e2e-test-deb-package path: target/artifacts/* - - name: (PR comment) Set latest commit status as 'failure' + - name: (PR review) Set latest commit status as 'failure' uses: myrotvorets/set-commit-status-action@v2.0.1 - if: failure() && github.event_name == 'issue_comment' + if: failure() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} status: 'failure' @@ -192,19 +187,19 @@ jobs: matrix: ${{ fromJson(needs.compute-k8s-test-plan.outputs.matrix) }} fail-fast: false steps: - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Get PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: xt0rted/pull-request-comment-branch@v2 id: comment-branch - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: ref: ${{ steps.comment-branch.outputs.head_ref }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - uses: actions/download-artifact@v3 @@ -225,11 +220,11 @@ jobs: SKIP_PACKAGE_DEB: "true" CARGO_INCREMENTAL: 0 - - name: (PR comment) Set latest commit status as failure + - name: (PR review) Set latest commit status as failure uses: myrotvorets/set-commit-status-action@v2.0.1 - if: failure() && github.event_name == 'issue_comment' + if: failure() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} status: 'failure' @@ -246,16 +241,16 @@ jobs: env: FAILED: ${{ contains(needs.*.result, 'failure') }} steps: - - name: (PR comment) Get PR branch - if: github.event_name == 'issue_comment' && env.FAILED != 'true' + - name: (PR review) Get PR branch + if: github.event_name == 'pull_request_review' && env.FAILED != 'true' uses: xt0rted/pull-request-comment-branch@v2 id: comment-branch - - name: (PR comment) Submit PR result as success - if: github.event_name == 'issue_comment' && env.FAILED != 'true' + - name: (PR review) Submit PR result as success + if: github.event_name == 'pull_request_review' && env.FAILED != 'true' uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} status: 'success' diff --git a/.github/workflows/misc.yml b/.github/workflows/misc.yml index aa00b2fa5d58d..ecd6b1ac9f70e 100644 --- a/.github/workflows/misc.yml +++ b/.github/workflows/misc.yml @@ -10,28 +10,23 @@ jobs: env: CARGO_INCREMENTAL: 0 steps: - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Miscellaneous - Linux status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout review SHA + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - uses: actions/cache@v4 @@ -53,11 +48,11 @@ jobs: - run: make check-examples - run: make test-docs - - name: (PR comment) Set latest commit status as ${{ job.status }} + - name: (PR review) Set latest commit status as ${{ job.status }} uses: myrotvorets/set-commit-status-action@v2.0.1 - if: always() && github.event_name == 'issue_comment' + if: always() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Miscellaneous - Linux status: ${{ job.status }} diff --git a/.github/workflows/regression.yml b/.github/workflows/regression.yml index 68a831f942692..466360f570596 100644 --- a/.github/workflows/regression.yml +++ b/.github/workflows/regression.yml @@ -2,7 +2,7 @@ # # This workflow runs under the following conditions: # - in the merge queue if any source files were modified, added or deleted. -# - on demand by a PR comment matching either of: +# - on demand by a PR review matching either of: # - '/ci-run-regression' # - '/ci-run-all' # (the comment issuer must be a member of the Vector GH team) @@ -130,9 +130,9 @@ jobs: # If triggered by issue comment, the event payload doesn't directly contain the head and base sha from the PR. # But, we can retrieve this info from some commands. - - name: Get PR metadata (issue_comment) + - name: Get PR metadata (pull_request_review) id: pr-metadata-comment - if: github.event_name == 'issue_comment' + if: github.event_name == 'pull_request_review' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -181,7 +181,7 @@ jobs: # queue to 1, we can get the PR number by parsing the merge queue temp branch's ref. - name: Get PR metadata (merge queue) id: pr-metadata-merge-queue - if: github.event_name != 'issue_comment' + if: github.event_name != 'pull_request_review' run: | export PR_NUMBER=$(echo "${{ github.ref }}" | sed -n 's|^refs/heads/gh-readonly-queue/master/pr-\([0-9]*\)-.*$|\1|p') echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_OUTPUT @@ -228,16 +228,11 @@ jobs: echo "smp crate version: ${SMP_CRATE_VERSION}" echo "SMP_CRATE_VERSION=${SMP_CRATE_VERSION}" >> $GITHUB_OUTPUT - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.pr-metadata-comment.outputs.COMPARISON_SHA }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Regression Detection Suite status: pending @@ -738,7 +733,7 @@ jobs: -f context='Regression Detection Suite / analyze-experiment' \ -f target_url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - # This job always runs- if an issue_comment triggered it, we need to update the check status in the PR, + # This job always runs- if an pull_request_review triggered it, we need to update the check status in the PR, # and if a pull_request triggered it, we need to flag the check status as a success. regression-detection-suite: name: Regression Detection Suite @@ -758,25 +753,20 @@ jobs: env: FAILED: ${{ contains(needs.*.result, 'failure') }} steps: - - name: (PR comment) Get PR branch - if: github.event_name == 'issue_comment' - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Submit PR result as failed - if: github.event_name == 'issue_comment' && env.FAILED == 'true' + - name: (PR review) Submit PR result as failed + if: github.event_name == 'pull_request_review' && env.FAILED == 'true' uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Regression Detection Suite status: 'failure' - - name: (PR comment) Submit PR result as success - if: github.event_name == 'issue_comment' && env.FAILED != 'true' + - name: (PR review) Submit PR result as success + if: github.event_name == 'pull_request_review' && env.FAILED != 'true' uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Regression Detection Suite status: 'success' diff --git a/.github/workflows/unit_mac.yml b/.github/workflows/unit_mac.yml index 0b4281b22cc7a..34a4febcf8689 100644 --- a/.github/workflows/unit_mac.yml +++ b/.github/workflows/unit_mac.yml @@ -10,29 +10,23 @@ jobs: env: CARGO_INCREMENTAL: 0 steps: - - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Unit - Mac status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - uses: actions/cache@v4 @@ -53,11 +47,11 @@ jobs: - run: make test - run: make test-behavior - - name: (PR comment) Set latest commit status as ${{ job.status }} + - name: (PR review) Set latest commit status as ${{ job.status }} uses: myrotvorets/set-commit-status-action@v2.0.1 - if: always() && github.event_name == 'issue_comment' + if: always() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Unit - Mac status: ${{ job.status }} diff --git a/.github/workflows/unit_windows.yml b/.github/workflows/unit_windows.yml index 46642beb1e273..c236ab8a2e45e 100644 --- a/.github/workflows/unit_windows.yml +++ b/.github/workflows/unit_windows.yml @@ -9,38 +9,33 @@ jobs: runs-on: windows-2019-8core timeout-minutes: 60 steps: - - name: (PR comment) Get PR branch - if: ${{ github.event_name == 'issue_comment' }} - uses: xt0rted/pull-request-comment-branch@v2 - id: comment-branch - - - name: (PR comment) Set latest commit status as pending - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Set latest commit status as pending + if: ${{ github.event_name == 'pull_request_review' }} uses: myrotvorets/set-commit-status-action@v2.0.1 with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Unit - Windows status: pending - - name: (PR comment) Checkout PR branch - if: ${{ github.event_name == 'issue_comment' }} + - name: (PR review) Checkout PR branch + if: ${{ github.event_name == 'pull_request_review' }} uses: actions/checkout@v3 with: - ref: ${{ steps.comment-branch.outputs.head_ref }} + ref: ${{ github.events.review.commit_id }} - name: Checkout branch - if: ${{ github.event_name != 'issue_comment' }} + if: ${{ github.event_name != 'pull_request_review' }} uses: actions/checkout@v3 - run: .\scripts\environment\bootstrap-windows-2019.ps1 - run: make test - - name: (PR comment) Set latest commit status as ${{ job.status }} + - name: (PR review) Set latest commit status as ${{ job.status }} uses: myrotvorets/set-commit-status-action@v2.0.1 - if: always() && github.event_name == 'issue_comment' + if: always() && github.event_name == 'pull_request_review' with: - sha: ${{ steps.comment-branch.outputs.head_sha }} + sha: ${{ github.events.review.commit_id }} token: ${{ secrets.GITHUB_TOKEN }} context: Unit - Windows status: ${{ job.status }}