Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow approver #2616

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
19 changes: 11 additions & 8 deletions .github/workflows/labeler-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

on:
pull_request_review:
types: [submitted, edited, dismissed]
types: [submitted]

permissions: write-all
permissions:
pull-requests: write
issues: write
contents: write
actions: write

jobs:
remove_label:
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
steps:
- name: check all revs
- name: check all reviewers
id: check_approvals
uses: actions/github-script@v7
with:
script: |
console.log('L:A verby 2255 22022025');
const { data: reviews } = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -31,14 +35,13 @@ jobs:
if: steps.check_approvals.outputs.result == 'true'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.URPRICE_PAT }}
script: |
const labelsToRemove = ['Status: Needs Review', 'Status: Awaiting Changes'];
const currentLabels = context.payload.pull_request.labels.map(label => label.name);

for (const label of labelsToRemove) {
if (currentLabels.includes(label)) {
await github.request("DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}", {
await github.request('DELETE /repos/{owner}/{repo}/issues/{issue_number}/labels/{name}', {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
Expand All @@ -47,4 +50,4 @@ jobs:
}
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
URPRICE_PAT: ${{ secrets.URPRICE_PAT }}
Loading