From 9b7c4ed353d8a7a735506248e051f8df4e7dfc4a Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 12 Sep 2024 10:19:44 +0800 Subject: [PATCH] chore: lock the pull request when workflow start --- .github/workflows/build-base-image.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/build-base-image.yml b/.github/workflows/build-base-image.yml index 03627bea4..3f8dd31e6 100644 --- a/.github/workflows/build-base-image.yml +++ b/.github/workflows/build-base-image.yml @@ -15,6 +15,11 @@ jobs: runs-on: ubuntu-latest steps: + - name: Lock Pull Request + run: | + curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -d '{"state":"pending", "description":"Action running, merge disabled", "context":"Lock PR"}' \ + "https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}" - name: Checkout repository uses: actions/checkout@v4 @@ -59,3 +64,9 @@ jobs: git push env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Unlock Pull Request + run: | + curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -d '{"state":"success", "description":"Action running, merge disabled", "context":"Lock PR"}' \ + "https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }}"