Skip to content

Commit

Permalink
Merge pull request c0sm0void#51 from toxic-for-code/master
Browse files Browse the repository at this point in the history
Auto labeler workflow failing c0sm0void#48
  • Loading branch information
c0sm0void authored Oct 8, 2024
2 parents f09fa48 + d3ab884 commit dbbd771
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Debug payload
run: echo "${{ toJson(github.event) }}"

- name: Label issues and PRs
uses: actions/github-script@v6
with:
script: |
const issue = context.payload.issue || context.payload.pull_request;
console.log('Issue:', issue);
const labels = [];
// Define keywords and their associated labels
Expand All @@ -38,11 +42,14 @@ jobs:
// Apply labels based on title or body content
for (const [keyword, label] of Object.entries(labelMappings)) {
if (issue.title.toLowerCase().includes(keyword) || issue.body.toLowerCase().includes(keyword)) {
if ((issue.title && issue.title.toLowerCase().includes(keyword)) ||
(issue.body && issue.body.toLowerCase().includes(keyword))) {
labels.push(label);
}
}
console.log('Labels to add:', labels);
if (labels.length > 0) {
github.rest.issues.addLabels({
owner: context.repo.owner,
Expand Down

0 comments on commit dbbd771

Please sign in to comment.