Files
oxc-project__oxc/.github/workflows/issue-labeled.yml

57 lines
2.4 KiB
YAML

name: Issue Labeled
on:
issues:
types: [labeled]
jobs:
reply-labeled:
if: github.repository == 'oxc-project/oxc'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: contribution welcome
if: github.event.label.name == 'good first issue' || github.event.label.name == 'E-Help Wanted'
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
mapfile -t labels < <(gh issue view "$ISSUE_NUMBER" --json labels --jq '.labels[].name | select(. == "pending triage" or . == "needs reproduction")')
if (( ${#labels[@]} > 0 )); then
args=()
for label in "${labels[@]}"; do
args+=(--remove-label "$label")
done
gh issue edit "$ISSUE_NUMBER" "${args[@]}"
fi
- name: needs reproduction
if: github.event.label.name == 'needs reproduction'
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_AUTHOR: ${{ github.event.issue.user.login }}
run: |
printf '%s\n' \
"Hello @$ISSUE_AUTHOR" \
"" \
"Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or a link to the [Oxc Playground](https://playground.oxc.rs). This helps us understand and resolve your issue much faster." \
"" \
"**A good reproduction should be:**" \
"- **Minimal** - include only the code necessary to demonstrate the issue" \
"- **Complete** - contain everything needed to run and observe the problem" \
"- **Reproducible** - consistently show the issue with clear steps" \
"" \
'If no reproduction is provided, issues labeled `needs reproduction` will be closed after 3 days of inactivity.' \
"" \
"For more context on why this is required, please read: https://antfu.me/posts/why-reproductions-are-required" \
| gh issue comment "$ISSUE_NUMBER" --body-file -
if [[ "$(gh issue view "$ISSUE_NUMBER" --json labels --jq 'any(.labels[].name; . == "pending triage")')" == "true" ]]; then
gh issue edit "$ISSUE_NUMBER" --remove-label "pending triage"
fi