Skip to content

bug fixes

bug fixes #59

name: Add Feature label
on:
- pull_request_target
jobs:
add-feature-label:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Find new files in src directory
run: |
NEW_FILES=$(git diff --name-only HEAD^ HEAD)
CHANGED_FILES=()
for file in $NEW_FILES; do
if [[ $file == "src/"* ]]; then
CHANGED_FILES+=("$file")
fi
done
echo "::set-output name=changed_files::${CHANGED_FILES[*]}"
id: find-files
- name: Add Feature label
if: ${{ steps.find-files.outputs.changed_files != '' }}
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = await github.issues.get(context.issue);
const labels = issue.data.labels.map(label => label.name);
if (!labels.includes('Feature')) {
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['Feature']
});
}