From d32783503592555f40d1afdde3df1615ff1f981d Mon Sep 17 00:00:00 2001 From: mxsm Date: Sat, 15 Jun 2024 23:23:52 +0800 Subject: [PATCH] Create work_flow_watch.yml --- .github/workflows/work_flow_watch.yml | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/work_flow_watch.yml diff --git a/.github/workflows/work_flow_watch.yml b/.github/workflows/work_flow_watch.yml new file mode 100644 index 00000000..1ac986c3 --- /dev/null +++ b/.github/workflows/work_flow_watch.yml @@ -0,0 +1,33 @@ +name: Work flow watch + +on: + workflow_run: + workflows: [ Add Label on Approval ] + types: + - completed + +jobs: + add-label: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Check if approval is from Collaborators + id: check_approval + uses: actions/github-script@v7 + env: + GITHUB_TOKEN: "${{ secrets.PAT }}" + with: + github-token: ${{ env.GITHUB_TOKEN }} + script: | + const { owner, repo } = context.repo; + const { pull_request } = context.payload; + + await github.rest.issues.addLabels({ + owner, + repo, + issue_number: pull_request.number, + labels: ['approved','auto merge'] + });