chore: Lowercase GitHub Labels
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
name: Report Issue
|
||||
description: Report a plugin issue in LNReader
|
||||
labels: [Bug]
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: dropdown
|
||||
id: source
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Request Feature
|
||||
description: Suggest an improvement for an existing plugin
|
||||
labels: [Feature Request]
|
||||
labels: [feature request]
|
||||
body:
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Request Plugin
|
||||
description: Request a new plugin for LNReader
|
||||
labels: [Plugin Request]
|
||||
labels: [plugin request]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
name: Report Issue
|
||||
description: Report a plugin issue in LNReader
|
||||
labels: [Bug]
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: dropdown
|
||||
id: source
|
||||
|
||||
@@ -8,7 +8,7 @@ const rawText = fs.readFileSync(
|
||||
);
|
||||
|
||||
async function main() {
|
||||
console.log(`Fetching plugins from: ${dist}`);
|
||||
console.log(`Fetching published plugin manifest from ${dist}...`);
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
@@ -22,7 +22,7 @@ async function main() {
|
||||
}
|
||||
|
||||
const pluginsRaw = await response.json();
|
||||
console.log(`Found ${pluginsRaw.length} plugins`);
|
||||
console.log(`Loaded ${pluginsRaw.length} plugins from the manifest.`);
|
||||
|
||||
const plugins = pluginsRaw.reduce((arr, plugin) => {
|
||||
arr[plugin.lang + ': ' + plugin.name] = plugin.id;
|
||||
@@ -36,24 +36,41 @@ async function main() {
|
||||
fs.readFileSync('.github/scripts/keys.json', 'utf8'),
|
||||
);
|
||||
savedKeys = Object.keys(keys);
|
||||
console.log(`Loaded ${savedKeys.length} existing plugin keys`);
|
||||
console.log(`Loaded ${savedKeys.length} saved plugin keys.`);
|
||||
} catch (err) {
|
||||
console.log('No existing keys file found, creating new one');
|
||||
console.log('No saved plugin keys found; a new key map will be created.');
|
||||
}
|
||||
|
||||
if (!sameKeys(newKeys, savedKeys) && Array.isArray(newKeys)) {
|
||||
console.log('Plugin list has changed, updating issue template...');
|
||||
const text = newKeys.join('"\n - "');
|
||||
fs.writeFileSync(
|
||||
'.github/ISSUE_TEMPLATE/report_issue.yml',
|
||||
rawText.replace(/{#CHANGE#}/g, '- "' + text + '"'),
|
||||
const text = newKeys.join('"\n - "');
|
||||
const issueTemplate = rawText.replace(/{#CHANGE#}/g, '- "' + text + '"');
|
||||
|
||||
const keysChanged = !sameKeys(newKeys, savedKeys) && Array.isArray(newKeys);
|
||||
if (keysChanged) {
|
||||
console.log(
|
||||
`Plugin keys changed (${savedKeys.length} → ${newKeys.length}); writing keys.json.`,
|
||||
);
|
||||
fs.writeFileSync('.github/scripts/keys.json', JSON.stringify(plugins));
|
||||
console.log('Issue template updated successfully');
|
||||
} else {
|
||||
console.log('No changes detected in plugin list');
|
||||
console.log('Plugin keys are up to date.');
|
||||
}
|
||||
|
||||
const templateChanged =
|
||||
fs.readFileSync('.github/ISSUE_TEMPLATE/report_issue.yml', 'utf8') !==
|
||||
issueTemplate;
|
||||
if (templateChanged) {
|
||||
fs.writeFileSync(
|
||||
'.github/ISSUE_TEMPLATE/report_issue.yml',
|
||||
issueTemplate,
|
||||
);
|
||||
console.log('Issue template changed; writing report_issue.yml.');
|
||||
} else {
|
||||
console.log('Issue template is up to date.');
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Generation complete (${keysChanged || templateChanged ? 'changes written' : 'no changes'}).`,
|
||||
);
|
||||
|
||||
function sameKeys(a, b) {
|
||||
return a.length === b.length && a.every(value => b.includes(value));
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ concurrency:
|
||||
jobs:
|
||||
auto-label:
|
||||
name: Auto Label Issues
|
||||
if: ${{ github.event.issue.body && contains(github.event.issue.body, '### Plugin') && contains(github.event.issue.labels.*.name, 'Bug') }}
|
||||
if: ${{ github.event.issue.body && contains(github.event.issue.body, '### Plugin') && contains(github.event.issue.labels.*.name, 'bug') }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -64,13 +64,16 @@ jobs:
|
||||
run: |
|
||||
LABELS="$(jq --arg keys "$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: /')"
|
||||
LABELS="$(printf '%s' "$LABELS" | node -e "process.stdin.on('data', data => process.stdout.write(data.toString().toLowerCase()))")"
|
||||
|
||||
# Add "plugin: " in front of each label
|
||||
LABELS_WITH_PREFIX="$(echo "$LABELS" | sed 's/^/plugin: /')"
|
||||
|
||||
FINAL_LABELS="$LABELS_WITH_PREFIX"
|
||||
|
||||
if [ -n "$SELECTED_LANGUAGE" ]; then
|
||||
FINAL_LABELS="${FINAL_LABELS}"$'\n'"Language: $SELECTED_LANGUAGE"
|
||||
LOWERCASE_LANGUAGE="$(printf '%s' "$SELECTED_LANGUAGE" | node -e "process.stdin.on('data', data => process.stdout.write(data.toString().toLowerCase()))")"
|
||||
FINAL_LABELS="${FINAL_LABELS}"$'\n'"language: $LOWERCASE_LANGUAGE"
|
||||
fi
|
||||
|
||||
# Save to GitHub environment
|
||||
@@ -84,9 +87,9 @@ jobs:
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
run: |
|
||||
jq -n \
|
||||
--arg severity "$SELECTED_SEVERITY" \
|
||||
--arg severity "$(printf '%s' "$SELECTED_SEVERITY" | node -e "process.stdin.on('data', data => process.stdout.write(data.toString().toLowerCase()))")" \
|
||||
--arg labels "$LABELS" \
|
||||
'{labels: (["Severity: " + $severity] + ($labels | split("\n") | map(select(length > 0))))}' \
|
||||
'{labels: (["severity: " + $severity] + ($labels | split("\n") | map(select(length > 0))))}' \
|
||||
| gh api --method POST "repos/$REPOSITORY/issues/$ISSUE_NUMBER/labels" --input -
|
||||
|
||||
- name: Handle Missing Label
|
||||
|
||||
@@ -19,11 +19,11 @@ jobs:
|
||||
uses: tachiyomiorg/issue-moderator-action@v2
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
duplicate-label: Duplicate
|
||||
duplicate-label: duplicate
|
||||
|
||||
duplicate-check-enabled: true
|
||||
duplicate-check-labels: |
|
||||
["Plugin Request", "Domain Changed"]
|
||||
["plugin request", "domain changed"]
|
||||
|
||||
existing-check-enabled: false
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ concurrency:
|
||||
jobs:
|
||||
auto-label:
|
||||
name: Auto Label Theme
|
||||
if: contains(github.event.issue.labels.*.name, 'Plugin Request')
|
||||
if: contains(github.event.issue.labels.*.name, 'plugin request')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
@@ -126,20 +126,20 @@ jobs:
|
||||
run: |
|
||||
echo "## Theme Detection Result" >> $GITHUB_STEP_SUMMARY
|
||||
if [[ "$MADARA" == "true" ]]; then
|
||||
echo "🏷️ Adding label: Theme: Madara" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Madara" -R $REPO
|
||||
echo "🏷️ Adding label: theme: madara" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "theme: madara" -R $REPO
|
||||
echo "theme=madara" >> "$GITHUB_OUTPUT"
|
||||
elif [[ "$LIGHNOVELWP" == "true" ]]; then
|
||||
echo "🏷️ Adding label: Theme: Lighnovelwp" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Lighnovelwp" -R $REPO
|
||||
echo "🏷️ Adding label: theme: lighnovelwp" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "theme: lighnovelwp" -R $REPO
|
||||
echo "theme=lightnovelwp" >> "$GITHUB_OUTPUT"
|
||||
elif [[ "$HOTNOVELPUB" == "true" ]]; then
|
||||
echo "🏷️ Adding label: Theme: Hotnovelpub" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Hotnovelpub" -R $REPO
|
||||
echo "🏷️ Adding label: theme: hotnovelpub" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "theme: hotnovelpub" -R $REPO
|
||||
echo "theme=hotnovelpub" >> "$GITHUB_OUTPUT"
|
||||
elif [[ "$FICTIONEER" == "true" ]]; then
|
||||
echo "🏷️ Adding label: Theme: Fictioneer" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "Theme: Fictioneer" -R $REPO
|
||||
echo "🏷️ Adding label: theme: fictioneer" >> $GITHUB_STEP_SUMMARY
|
||||
gh issue edit $ISSUE_NUMBER --add-label "theme: fictioneer" -R $REPO
|
||||
echo "theme=fictioneer" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "❌ No Theme Detected" >> $GITHUB_STEP_SUMMARY
|
||||
|
||||
Reference in New Issue
Block a user