Skip to content

Commit

Permalink
chore: update labelling workflow
Browse files Browse the repository at this point in the history
Update it to match Hardhat + using the latest version and adding a
retry.
  • Loading branch information
kanej committed Apr 29, 2024
1 parent 2618166 commit 252bd9a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/add-label-to-new-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Add label to new issue
on:
issues:
types: [opened]
pull_request:
pull_request_target:
types: [opened]

jobs:
Expand All @@ -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,
Expand All @@ -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}`);
Expand Down

0 comments on commit 252bd9a

Please sign in to comment.