0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-24 22:41:28 -05:00

ci: use add labels run steps (#96)

This commit is contained in:
Gao Sun 2021-08-28 17:50:26 +08:00 committed by GitHub
parent 625520d75a
commit 9546aee496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -10,29 +10,7 @@ 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
- uses: logto-io/actions-add-labels-run-steps@v1.0.1
with:
github_token: ${{ github.token }}
labels: ${{ steps.extract-label.outputs.labels_to_add }}
title: ${{ github.event.pull_request.title || github.event.issue.title }}
github-token: ${{ github.token }}