0e37fbc567
* Add automatic issue labeling * branch issue fix * try debug * maybe * fix indents * f it I use js * disable for testing * changed id * added git * Update issue template with plugin dropdown options * Only push on change * Add multiple * save keys file and additional safety * Update issue template with plugin dropdown options * delete updated_issue.yml * Add Language in front of plugin name * Update issue template with plugin dropdown options * Add Labels * debug auto labeling * new extraction method * SELECTED_PLUGINS not available * Maybe * maybe this * Now * please * Now really * maybe * debug * debug * remove linebreak * delete " * delete " differently * corrected split * fix multiline issue * maybe this way * Added Severity * Update issue template with plugin dropdown options * ignore if not plugin issue * add string infront of labels * Update issue template with plugin dropdown options * Test job skip * Test job skip 2 * Test job skip 2.1 * reactivated checks * Added [skip ci] to commit message * change label format * pr test * test change * deactivate skip * activate skip --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
65 lines
2.2 KiB
YAML
65 lines
2.2 KiB
YAML
name: Auto Label Issues
|
|
|
|
on:
|
|
issues:
|
|
types:
|
|
- opened
|
|
- edited
|
|
|
|
jobs:
|
|
auto-label:
|
|
if: ${{ github.event.issue.body && contains(github.event.issue.body, '### Plugin') }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Extract the severity from issue body
|
|
id: extract-severity
|
|
run: |
|
|
USER_SELECTED_SEVERITY=$(echo "${{ github.event.issue.body }}" | grep "### Severity" -A 2 | tail -n 1 | sed 's/[[:space:]]*$//')
|
|
SELECTED_SEVERITY=""
|
|
|
|
case "$USER_SELECTED_SEVERITY" in
|
|
"Wrong formatting"|"Wrong content"|"Missing chapter"|"Missing images"|"Can't load novels")
|
|
SELECTED_SEVERITY="$USER_SELECTED_SEVERITY"
|
|
;;
|
|
*)
|
|
SELECTED_SEVERITY="Other"
|
|
;;
|
|
esac
|
|
echo "SELECTED_SEVERITY=$SELECTED_SEVERITY" >> $GITHUB_ENV
|
|
|
|
- name: Extract the plugin from issue body
|
|
id: parse-issue
|
|
run: |
|
|
SELECTED_PLUGIN=$(echo "${{ github.event.issue.body }}" | grep "### Plugin" -A 2 | tail -n 1 | sed 's/[[:space:]]*$//')
|
|
|
|
echo "SELECTED_PLUGIN=$SELECTED_PLUGIN" >> $GITHUB_ENV
|
|
|
|
- name: Determine corresponding label
|
|
id: determine-label
|
|
run: |
|
|
LABELS="$( jq --arg keys "${{ env.SELECTED_PLUGIN }}" '. as $data | $keys | split(", ") as $keyList | $keyList[] | . as $key | if $data[$key] != null then "\($key)[\($data[$key])]" else empty end' ./.github/scripts/keys.json | sed 's/"//g' | sed 's/^[^:]*: //' )"
|
|
|
|
# Add "Plugin: " in front of each label
|
|
LABELS_WITH_PREFIX="$(echo "$LABELS" | sed 's/^/Plugin: /')"
|
|
|
|
# Save to GitHub environment
|
|
printf "LABELS<<EOF\n%s\nEOF\n" "$LABELS_WITH_PREFIX" >> $GITHUB_ENV
|
|
|
|
|
|
- name: Add label to the issue
|
|
if: env.LABELS != ''
|
|
uses: actions-ecosystem/action-add-labels@v1
|
|
with:
|
|
labels: |
|
|
BUG
|
|
Severity: ${{ env.SELECTED_SEVERITY }}
|
|
${{ env.LABELS }}
|
|
|
|
- name: Handle missing label
|
|
if: env.LABELS == ''
|
|
run: echo "No matching label found for the selected plugin."
|