Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 48 additions & 16 deletions .github/workflows/theme_auto_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:

- name: Check Lightnovelwp Theme
id: check_lighnovelwp
if: always() && steps.check_madara.outputs.madara != 'true'
if: always()
env:
BASE_URL: ${{ steps.get_base_url.outputs.BASE_URL }}
USER_AGENT: ${{ steps.get_user_agent.outputs.USER_AGENT }}
Expand All @@ -79,7 +79,7 @@ jobs:

- name: Check HotNovelPub Theme
id: check_hotnovelpub
if: always() && steps.check_madara.outputs.madara != 'true' && steps.check_lighnovelwp.outputs.lighnovelwp != 'true'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't removing this still check the other themes, even if it's already determined to be one?

if: always()
env:
BASE_URL: ${{ steps.get_base_url.outputs.BASE_URL }}
USER_AGENT: ${{ steps.get_user_agent.outputs.USER_AGENT }}
Expand All @@ -96,7 +96,7 @@ jobs:

- name: Check Fictioneer Theme
id: check_fictioneer
if: always() && steps.check_madara.outputs.madara != 'true' && steps.check_lighnovelwp.outputs.lighnovelwp != 'true' && steps.check_hotnovelpub.outputs.hotnovelpub != 'true'
if: always()
env:
BASE_URL: ${{ steps.get_base_url.outputs.BASE_URL }}
USER_AGENT: ${{ steps.get_user_agent.outputs.USER_AGENT }}
Expand All @@ -111,28 +111,60 @@ jobs:
echo "❌ Fictioneer Theme Not Found" >> $GITHUB_STEP_SUMMARY
fi

- name: Check Novel Fire Theme
id: check_novel_fire
if: always()
env:
BASE_URL: ${{ steps.get_base_url.outputs.BASE_URL }}
USER_AGENT: ${{ steps.get_user_agent.outputs.USER_AGENT }}
run: |
echo "🔍 Checking for Novel Fire theme..." >> $GITHUB_STEP_SUMMARY
if curl --location --output /dev/null --silent --head --fail --max-time 10 "https://$BASE_URL/frontend/js/appsettings.min.js" -H "User-Agent: $USER_AGENT" 2>/dev/null || \
curl --location --output /dev/null --silent --head --fail --max-time 10 "http://$BASE_URL/frontend/js/appsettings.min.js" -H "User-Agent: $USER_AGENT" 2>/dev/null; then
echo "novel_fire=true" >> $GITHUB_OUTPUT
echo "✅ Novel Fire Theme Detected" >> $GITHUB_STEP_SUMMARY
else
echo "novel_fire=false" >> $GITHUB_OUTPUT
echo "❌ Novel Fire Theme Not Found" >> $GITHUB_STEP_SUMMARY
fi

- name: Add Theme Label To Issue
if: always()
env:
MADARA: ${{ steps.check_madara.outputs.madara }}
LIGHNOVELWP: ${{ steps.check_lighnovelwp.outputs.lighnovelwp }}
HOTNOVELPUB: ${{ steps.check_hotnovelpub.outputs.hotnovelpub }}
FICTIONEER: ${{ steps.check_fictioneer.outputs.fictioneer }}
NOVEL_FIRE: ${{ steps.check_novel_fire.outputs.novel_fire }}
GH_TOKEN: ${{ github.token }}
run: |
MATCH_COUNT=0
[[ "$MADARA" == "true" ]] && ((MATCH_COUNT+=1))
[[ "$LIGHNOVELWP" == "true" ]] && ((MATCH_COUNT+=1))
[[ "$HOTNOVELPUB" == "true" ]] && ((MATCH_COUNT+=1))
[[ "$FICTIONEER" == "true" ]] && ((MATCH_COUNT+=1))
[[ "$NOVEL_FIRE" == "true" ]] && ((MATCH_COUNT+=1))

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
elif [[ "$LIGHNOVELWP" == "true" ]]; then
echo "🏷️ Adding label: Theme: Lighnovelwp" >> $GITHUB_STEP_SUMMARY
gh issue edit $ISSUE_NUMBER --add-label "Theme: Lighnovelwp" -R $REPO
elif [[ "$HOTNOVELPUB" == "true" ]]; then
echo "🏷️ Adding label: Theme: Hotnovelpub" >> $GITHUB_STEP_SUMMARY
gh issue edit $ISSUE_NUMBER --add-label "Theme: Hotnovelpub" -R $REPO
elif [[ "$FICTIONEER" == "true" ]]; then
echo "🏷️ Adding label: Theme: Fictioneer" >> $GITHUB_STEP_SUMMARY
gh issue edit $ISSUE_NUMBER --add-label "Theme: Fictioneer" -R $REPO
if (( MATCH_COUNT > 1 )); then

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could a site have multiple matches?

echo "⚠️ Multiple themes detected ($MATCH_COUNT)." >> $GITHUB_STEP_SUMMARY
else
echo "❌ No Theme Detected" >> $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
elif [[ "$LIGHNOVELWP" == "true" ]]; then
echo "🏷️ Adding label: Theme: Lighnovelwp" >> $GITHUB_STEP_SUMMARY
gh issue edit $ISSUE_NUMBER --add-label "Theme: Lighnovelwp" -R $REPO
elif [[ "$HOTNOVELPUB" == "true" ]]; then
echo "🏷️ Adding label: Theme: Hotnovelpub" >> $GITHUB_STEP_SUMMARY
gh issue edit $ISSUE_NUMBER --add-label "Theme: Hotnovelpub" -R $REPO
elif [[ "$FICTIONEER" == "true" ]]; then
echo "🏷️ Adding label: Theme: Fictioneer" >> $GITHUB_STEP_SUMMARY
gh issue edit $ISSUE_NUMBER --add-label "Theme: Fictioneer" -R $REPO
elif [[ "$NOVEL_FIRE" == "true" ]]; then
echo "🏷️ Adding label: Theme: Novel Fire" >> $GITHUB_STEP_SUMMARY
gh issue edit $ISSUE_NUMBER --add-label "Theme: Novel Fire" -R $REPO
else
echo "❌ No Theme Detected" >> $GITHUB_STEP_SUMMARY
fi
fi
Loading