2021-08-10 02:08:26 -05:00
|
|
|
name: Add Labels
|
|
|
|
|
2021-08-25 10:35:35 -05:00
|
|
|
on:
|
|
|
|
issues:
|
|
|
|
types: [opened, edited, reopened]
|
|
|
|
pull_request:
|
|
|
|
types: [opened, edited, synchronize, reopened]
|
2021-08-10 02:08:26 -05:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
add_labels:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-08-20 05:16:00 -05:00
|
|
|
|
2021-08-10 02:08:26 -05:00
|
|
|
- name: Extract Label
|
|
|
|
id: extract-label
|
|
|
|
run: |
|
|
|
|
echo "::set-output name=labels_to_add::$(
|
|
|
|
node -e "
|
|
|
|
const title = process.env.TITLE;
|
|
|
|
const labelMapping = {
|
|
|
|
chore: 'chore',
|
|
|
|
feat: 'feature',
|
|
|
|
fix: 'bugfix',
|
|
|
|
refactor: 'enhancement',
|
|
|
|
test: 'enhancement',
|
|
|
|
};
|
|
|
|
const foundKey = Object.keys(labelMapping).find((label) => title && title.startsWith(label));
|
|
|
|
console.log(foundKey ? labelMapping[foundKey] : '');
|
|
|
|
"
|
|
|
|
)"
|
|
|
|
env:
|
|
|
|
TITLE: ${{ github.event.pull_request.title || github.event.issue.title }}
|
2021-08-20 05:16:00 -05:00
|
|
|
|
2021-08-10 02:08:26 -05:00
|
|
|
- uses: actions-ecosystem/action-add-labels@v1.1.0
|
|
|
|
with:
|
|
|
|
github_token: ${{ github.token }}
|
|
|
|
labels: ${{ steps.extract-label.outputs.labels_to_add }}
|