User plugin issue labeling (#1397)
* 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>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
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."
|
||||
@@ -0,0 +1,38 @@
|
||||
name: Update Issue Template
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- Publish Plugins
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
update_template:
|
||||
if: github.repository == 'LNReader/lnreader-plugins' && github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Recreating report issue template
|
||||
run: |
|
||||
node ./.github/scripts/createOptions.cjs
|
||||
|
||||
- name: Create or Update Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
commit-message: '[skip ci] Update issue template with plugin dropdown options'
|
||||
branch: 'update-issue-template'
|
||||
title: 'Update Issue Template'
|
||||
body: |
|
||||
This PR updates the issue template with the latest plugin dropdown options.
|
||||
If this PR already exists, it will be updated automatically with the latest changes.
|
||||
labels: 'bot'
|
||||
base: 'master'
|
||||
delete-branch: true
|
||||
Reference in New Issue
Block a user