Skip to content

Commit

Permalink
Merge pull request #8800 from renanfranca/8528-setup-new-labeling-git…
Browse files Browse the repository at this point in the history
…hub-action

Setup new triage labeling
  • Loading branch information
pascalgrimaud committed Feb 1, 2024
2 parents 47e0002 + 9a6eff6 commit 5b44cf6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Label all new issues or PRs for area: triage
'area: triage':
- '/.*/'
40 changes: 40 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Triage pull requests and issues
on:
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- name: View context attributes
uses: actions/github-script@v7
with:
script: console.log(context)
- name: Check for existing labels
id: check-issue-pr-labels
uses: actions/github-script@v7
with:
script: |
const issue = context.payload.issue;
const pr = context.payload.pull_request;
function hasLabels(obj) {
return obj.labels && Array.isArray(obj.labels) && obj.labels.length > 0;
}
const hasLabelsResult = hasLabels(issue || pr);
console.log('Label count:', hasLabelsResult ? (issue || pr).labels.length : 0);
console.log('Has labels:', hasLabelsResult);
return hasLabelsResult;
- name: Label issues and PRs
if: steps.check-issue-pr-labels.outputs.result == 'false'
uses: github/issue-labeler@v3.4
with:
configuration-path: .github/labeler.yml
enable-versioned-regex: 0
repo-token: ${{ secrets.GITHUB_TOKEN }}
15 changes: 0 additions & 15 deletions .github/workflows/triage.yml

This file was deleted.

0 comments on commit 5b44cf6

Please sign in to comment.