mirror of
https://github.com/logto-io/logto.git
synced 2025-03-10 22:22:45 -05:00
chore: add labels according to title
This commit is contained in:
parent
9dcc472135
commit
0f4354b5f2
1 changed files with 32 additions and 0 deletions
32
.github/workflows/add-labels.yml
vendored
Normal file
32
.github/workflows/add-labels.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Add Labels
|
||||
|
||||
on: [issues, pull_request]
|
||||
|
||||
jobs:
|
||||
add_labels:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- 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 }}
|
||||
- uses: actions-ecosystem/action-add-labels@v1.1.0
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
labels: ${{ steps.extract-label.outputs.labels_to_add }}
|
Loading…
Add table
Reference in a new issue