diff --git a/.github/workflows/label-on-approval.yml b/.github/workflows/label-on-approval.yml index b4e49235..525a06b7 100644 --- a/.github/workflows/label-on-approval.yml +++ b/.github/workflows/label-on-approval.yml @@ -2,7 +2,11 @@ name: Add Label on Approval on: pull_request_review: - types: [ submitted,edited ] + types: [submitted] + +permissions: + issues: write + pull-requests: write jobs: add-label: @@ -15,14 +19,15 @@ jobs: - name: Check if approval is from Collaborators id: check_approval uses: actions/github-script@v7 - env: - GITHUB_TOKEN: "${{ secrets.PAT }}" with: - github-token: ${{ evn.GITHUB_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} script: | const { owner, repo } = context.repo; const { pull_request, review } = context.payload; - + if (!review) { + console.log('No review found.'); + return; + } // Define your list of collaborators const collaborators = ['mxsm', 'TeslaRustor','SpaceXCN']; // Replace with actual GitHub usernames console.log('review:', review.state);