From 252bd9aa4dd5def4c5cd9e7b4d94f6336176e27f Mon Sep 17 00:00:00 2001 From: John Kane Date: Mon, 29 Apr 2024 14:36:48 +0100 Subject: [PATCH] chore: update labelling workflow Update it to match Hardhat + using the latest version and adding a retry. --- .github/workflows/add-label-to-new-issue.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/add-label-to-new-issue.yml b/.github/workflows/add-label-to-new-issue.yml index 8b1a9028..76378fe8 100644 --- a/.github/workflows/add-label-to-new-issue.yml +++ b/.github/workflows/add-label-to-new-issue.yml @@ -3,7 +3,7 @@ name: Add label to new issue on: issues: types: [opened] - pull_request: + pull_request_target: types: [opened] jobs: @@ -13,13 +13,10 @@ jobs: issues: write pull-requests: write steps: - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: "18.x" - - uses: actions/github-script@v7 + id: set-ready-or-triaging-label with: + retries: 3 script: | const issue = await github.rest.issues.get({ owner: context.issue.owner, @@ -32,11 +29,15 @@ jobs: ); if (statusLabel === undefined) { + console.log("Author association:", issue.data.author_association); + const isCollaborator = ["OWNER", "MEMBER", "COLLABORATOR"].includes(issue.data.author_association) + const label = isCollaborator ? "status:ready" : "status:triaging" + await github.rest.issues.addLabels({ owner: context.issue.owner, repo: context.issue.repo, issue_number: context.issue.number, - labels: ["status:triaging"] + labels: [label] }); } else { console.log(`Issue already has a status: ${statusLabel.name}`);