diff --git a/.github/workflows/approved_status.yml b/.github/workflows/approved_status.yml new file mode 100644 index 00000000..8c8a94b9 --- /dev/null +++ b/.github/workflows/approved_status.yml @@ -0,0 +1,39 @@ +name: Send PR Approval Status + +permissions: + contents: read + +on: + pull_request: + branches: + - main + types: ["review_requested", "synchronize", "opened", "reopened"] + pull_request_review: + types: + - submitted + - dismissed + +jobs: + send_status: + runs-on: ubuntu-latest + if: > + github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name == github.repository && + !contains(github.event.pull_request.labels.*.name, 'ci/skip') && + !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/') && + startsWith(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') + permissions: + id-token: write + steps: + - name: Get GitHub token + id: get_token + uses: DataDog/dd-octo-sts-action@c85802a58e202b7e764b5441e4378c76043c8108 # v1.0.5 + with: + scope: DataDog/datadog-api-spec + policy: pup.approved_status.post-review-status + - name: Post PR review status check + uses: DataDog/github-actions/post-review-status@65b4875f33ad773d7ba4b005a2cb5f35020295f3 # v2.3.0 + with: + github-token: ${{ steps.get_token.outputs.token }} + repo: datadog-api-spec + context: pup/main diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc06f6a1..fff5cd1d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -244,3 +244,30 @@ jobs: ls -lh target/wasm32-wasip2/release/pup.wasm echo "Browser WASM:" ls -lh pkg/pup_wasm_bg.wasm + + report: + name: Report status to datadog-api-spec + runs-on: ubuntu-latest + if: always() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') + needs: + - check-test-coverage + - cross-compile-linux + - cross-compile-macos + - cross-compile-windows + - wasm + permissions: + id-token: write + steps: + - uses: DataDog/dd-octo-sts-action@c85802a58e202b7e764b5441e4378c76043c8108 # v1.0.5 + id: octo-sts + with: + scope: DataDog/datadog-api-spec + policy: pup.ci.post-status-check + - name: Post status check + uses: DataDog/github-actions/post-status-check@65b4875f33ad773d7ba4b005a2cb5f35020295f3 # v2.3.0 + with: + github-token: ${{ steps.octo-sts.outputs.token }} + repo: datadog-api-spec + # A cancelled run was superseded by a newer push to the generated branch. + status: ${{ contains(needs.*.result, 'cancelled') && 'pending' || (contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped')) && 'failure' || 'success' }} + context: main/unit