Skip to content

Commit

Permalink
Merge pull request #13027 from ethereum/fix-labeler
Browse files Browse the repository at this point in the history
fix: labeler yml syntax, add labeler refining step
  • Loading branch information
corwintines authored May 27, 2024
2 parents f49d9da + b8a98db commit 6649f02
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@
"translation 🌍":
- public/content/translations/**/*
- src/intl/**/*
- !src/intl/en/**

"content 🖋️":
- src/intl/en/**
- public/content/**/*
- !public/content/translations/**/*

"event 📅":
- src/data/community-events.json
23 changes: 23 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,26 @@ jobs:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Refine labels
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
const { owner, repo, number: pull_number } = context.issue;
const { data: files } = await github.pulls.listFiles({ owner, repo, pull_number });
const allInEn = files.every(file => file.filename.startsWith('src/intl/en/'));
const allInTranslations = files.every(file => file.filename.startsWith('public/content/translations/'));
if (allInEn) {
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'translation 🌍' });
}
if (allInTranslations) {
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'content 🖋️' });
}
} catch (error) {
console.warn("Problem occurred refining labels")
}

0 comments on commit 6649f02

Please sign in to comment.