[pull] dev from ethereum:dev #6136
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Labeler | |
on: | |
- pull_request_target | |
jobs: | |
label: | |
runs-on: ubuntu-latest | |
steps: | |
- 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") | |
} |