From 64b716ceda3109ef35bbc0fd4286398d846a4d17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Zacchino?= Date: Thu, 27 Feb 2025 15:17:20 -0300 Subject: [PATCH] [IMP] partner: pre-commit improvements --- .github/workflows/pre-commit.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 0915d8c3..d278e5ac 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -6,8 +6,8 @@ name: pre-commit on: push: - branches: "*.0" - pull_request: + branches: "[0-9][0-9].0" + pull_request_target: jobs: pre-commit: @@ -16,6 +16,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }} - id: setup-python name: Setup Python @@ -32,3 +34,15 @@ jobs: - name: Pre-commit uses: pre-commit/action@v3.0.1 + - + name: Create commit status + if: github.event_name == 'pull_request_target' + run: | + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \ + -d '{"state":"${{ steps.precommit.outcome }}","context":"mergebot/pre-commit"}' \ + --fail