Skip to content

Commit

Permalink
Update auto-label.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
multiverseweb authored Nov 5, 2024
1 parent d33b71a commit d8a001e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@

name: Auto Label Issue
name: Auto Label Issue and PR

on:
issues:
types: [opened, reopened, edited]
pull_request:
types: [opened, reopened, edited]

jobs:
label_issue:
label_issue_or_pr:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: Label Issue with Custom Color
- name: Label Issue or PR with Custom Color
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue = context.payload.issue;
const issueOrPr = context.payload.issue || context.payload.pull_request;
// Function to create or update a label with the specified color
const createOrUpdateLabel = async (label, color) => {
Expand All @@ -42,7 +44,7 @@ jobs:
repo: context.repo.repo,
name: label,
color: color,
description: `Waiting for the Dataverse's Maintainer to review this issue.`
description: `Waiting for the Dataverse's Maintainer's review.`
});
}
};
Expand All @@ -51,11 +53,11 @@ jobs:
const label = 'Review Queued';
const color = 'faff00'; // Custom color hex code
// Create or update the label and apply it to the issue
// Create or update the label and apply it to the issue or PR
await createOrUpdateLabel(label, color);
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
issue_number: issueOrPr.number,
labels: [label]
});

0 comments on commit d8a001e

Please sign in to comment.