Skip to content

Add Neko Atsume 2 and Crowdin icons, and a minor change #1

Add Neko Atsume 2 and Crowdin icons, and a minor change

Add Neko Atsume 2 and Crowdin icons, and a minor change #1

Workflow file for this run

name: Build Pages
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- main
paths:
- 'newicons/appfilter.xml'
push:
branches: ['Arcticons-Pages','main']
paths:
- 'docs/**'
- 'newicons/appfilter.xml'
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '30 5 * * 0,3'
workflow_dispatch:
inputs:
run_colormapping:
description: "Run Create_Colormappping job"
type: boolean
required: false
default: false
run_requestjson:
description: "Run Create_requestjson job"
type: boolean
required: false
default: false
run_Request_Update:
description: "Run Update_Requests job"
type: boolean
required: false
default: false
run_fetch_and_push_file:
description: "Run fetch_and_push_file job"
type: boolean
required: false
default: false
run_build_pages:
description: "Run parse_and_combine job"
type: boolean
required: false
default: false
jobs:
fetch_and_push_file:
name: Fetch and Push File
if: ${{ github.repository == vars.REPOSITORY && ((github.event_name == 'push' && github.ref_name == vars.MAIN_BRANCH) || (github.event_name == 'workflow_dispatch' && inputs.run_fetch_and_push_file == true)) }}
runs-on: ubuntu-latest
concurrency:
group: push
cancel-in-progress: false
environment:
name: FileSync
env:
SOURCE_BRANCH: ${{vars.MAIN_BRANCH}}
TARGET_BRANCH: ${{vars.PAGES_BRANCH}}
FILE_PATH: newicons/appfilter.xml
steps:
# Step 1: Checkout the repository
- name: Checkout main Repository
uses: actions/checkout@v4
with:
ref: ${{vars.MAIN_BRANCH}}
path: main
# Step 2: Checkout the 2. repository
- name: Checkout Arcticons-Pages Repository
uses: actions/checkout@v4
with:
ref: ${{vars.PAGES_BRANCH}}
path: pages
# Step 3: Fetch the file from the source branch
- name: Copy File from main to Arcticons-Pages
run: |
rm pages/newicons/appfilter.xml
cp main/newicons/appfilter.xml pages/newicons/appfilter.xml
# Step 4: Commit and push changes
- name: Commit and Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd pages
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add $FILE_PATH
git commit -m "Update $FILE_PATH from $SOURCE_BRANCH to $TARGET_BRANCH"
git push
check_appfilter:
name: Check appfilter.xml from pull_request
if: github.event_name == 'pull_request_target'
runs-on: ubuntu-latest
permissions:
pull-requests: write # Required to comment on PRs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.user.login }}/${{ github.event.pull_request.head.ref }}
cancel-in-progress: true
steps:
- name: Checkout Repository ${{ github.event.pull_request.user.login }}/${{ github.event.pull_request.head.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
sparse-checkout: |
newicons/appfilter.xml
sparse-checkout-cone-mode: false
- name: Install xmllint
shell: bash
run: |
sudo apt update
sudo apt install -y libxml2-utils
- name: Validate appfilter.xml
id: validate
run: |
if ! PARSE_OUTPUT=$(xmllint --noout newicons/appfilter.xml 2>&1) ; then
echo "Parsing appfilter.xml failed."
echo -e "Parsing of 'newicons/appfilter.xml' failed. Please fix the XML syntax errors. \n \`\`\` \n $PARSE_OUTPUT \n \`\`\`" >> comment_markdown.md
exit 1
else
echo "Parsing succeeded."
fi
- name: Post failure comment to PR
if: failure()
run: |
gh pr comment ${{ github.event.pull_request.number }} --body-file comment_markdown.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Update_Requests:
if: ${{ github.repository == vars.REPOSITORY && ( inputs.run_Request_Update == true || github.event_name == 'schedule') && vars.AUTOMATIC_UPDATE == 'true' }}
environment:
name: Request-Update
concurrency:
group: 'push'
cancel-in-progress: false
runs-on: ubuntu-latest
outputs:
changes_detected: ${{ steps.check_changes.outputs.changes_detected }}
request_changes: ${{ steps.check_changes.outputs.Request_changes }}
image_changes: ${{ steps.check_changes.outputs.Image_changes }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{vars.PAGES_BRANCH}}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- run: pip install -r .github/workflows/requirements.txt
- name: Execute Python Script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REQUEST_LIMIT: ${{ vars.REQUEST_LIMIT }}
MONTHS_LIMIT: ${{ vars.MONTHS_LIMIT }}
MIN_REQUESTS: ${{ vars.MIN_REQUESTS }}
SUBJECT_PREFIX: ${{ vars.SUBJECT_PREFIX }}
SUBJECT_SUFFIX: ${{ vars.SUBJECT_SUFFIX }}
IMAP_SERVER: ${{ secrets.IMAP_SERVER }}
IMAP_USERNAME: ${{ secrets.IMAP_USERNAME }}
IMAP_PASSWORD: ${{ secrets.IMAP_PASSWORD }}
run: |
mkdir mail
python .github/workflows/email_parser_auto.py mail newicons/appfilter.xml docs/extracted_png docs/assets/
rm -r mail
- name: Check for changes
id: check_changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add -A
# Get the list of changed files
CHANGED_FILES=$(git diff --cached --name-only)
# Check if there are any changes
if [ -z "$CHANGED_FILES" ]; then
echo "No changes detected"
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "changes_detected=true" >> $GITHUB_OUTPUT
# Set different outputs depending on which path changed
if echo "$CHANGED_FILES" | grep -q "^docs/assets/requests.txt"; then
echo "Request_changes=true" >> $GITHUB_OUTPUT
fi
if echo "$CHANGED_FILES" | grep -q "^docs/extracted_png/"; then
echo "Image_changes=true" >> $GITHUB_OUTPUT
fi
# You can add more checks for other directories or files here as needed
fi
- name: Commit and Push if Changes Exist
if: ${{ steps.check_changes.outputs.changes_detected == 'true' }}
run: |
git commit -m "Automated Request Update"
git push
Check_FilePath:
name: Check File Path changes
if: ${{github.event_name == 'push' && github.ref_name == vars.PAGES_BRANCH}}
runs-on: ubuntu-latest
outputs:
imagechange: ${{ steps.changes.outputs.images }}
requestchange: ${{ steps.changes.outputs.requests }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{vars.PAGES_BRANCH}}
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
images:
- 'docs/extracted_png/**'
requests:
- 'docs/assets/requests.txt'
base: ${{vars.PAGES_BRANCH}}
Create_Colormappping:
name: Create Colormapping
needs: [Check_FilePath, Update_Requests]
if: ${{ ((needs.Check_FilePath.outputs.imagechange == 'true' && github.event_name == 'push') || (((github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && needs.Update_Requests.outputs.image_changes == 'true') || (inputs.run_colormapping == true && inputs.run_Request_Update == false ))) && !failure() }}
runs-on: ubuntu-latest
concurrency:
group: 'colormapping'
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{vars.PAGES_BRANCH}}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- run: pip install -r .github/workflows/requirements.txt
- name: Execute Python Script
id: colormapping_done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python .github/workflows/create_colormapping.py
- name: Upload Colormapping
uses: actions/upload-artifact@v4
with:
name: colormapping
path: docs/assets/image_color_counts.xml
Create_requestjson:
name: Create Requestjson
needs: [Check_FilePath, Update_Requests]
if: ${{ ((needs.Check_FilePath.outputs.requestchange == 'true' && github.event_name == 'push') || (((github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && needs.Update_Requests.outputs.request_changes == 'true') || (inputs.run_requestjson == true && inputs.run_Request_Update == false ))) && !failure() }}
runs-on: ubuntu-latest
concurrency:
group: 'requestjson'
cancel-in-progress: true
outputs:
requestjson_done: ${{ steps.requestjson_done.outcome }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{vars.PAGES_BRANCH}}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- run: pip install -r .github/workflows/requirements.txt
- name: Execute Python Script
id: requestjson_done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python .github/workflows/getGPlayData.py
- name: Upload Requestjson
uses: actions/upload-artifact@v4
with:
name: requestjson
path: docs/assets/requests.json
Push_Files:
needs: [Create_Colormappping, Create_requestjson]
runs-on: ubuntu-latest
concurrency:
group: 'push'
cancel-in-progress: false
if: ${{(needs.Create_Colormappping.result == 'success' || needs.Create_requestjson.result == 'success') && !failure()}}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{vars.PAGES_BRANCH}}
- name: Download Colormapping and Requestjson
uses: actions/download-artifact@v4
with:
path: docs/assets
merge-multiple: true
- name: Check for changes
id: check_changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add -A
# Get the list of changed files
CHANGED_FILES=$(git diff --cached --name-only)
# Check if there are any changes
if [ -z "$CHANGED_FILES" ]; then
echo "No changes detected"
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "changes_detected=true" >> $GITHUB_OUTPUT
fi
- name: Commit and Push if Changes Exist
if: ${{ steps.check_changes.outputs.changes_detected == 'true' }}
run: |
git commit -m "Automated updates from Colormappping and Requestjson jobs"
git push
parse_and_combine:
name: Parse and Combine Appfilter
needs: [check_appfilter, Push_Files,fetch_and_push_file,Update_Requests,Check_FilePath]
if: ${{(needs.Check_FilePath.result == 'success' ||needs.check_appfilter.result == 'success' || needs.Push_Files.result == 'success' || needs.fetch_and_push_file.result == 'success' ||(needs.Update_Requests.result == 'success' && needs.Update_Requests.outputs.changes_detected == 'true' )||inputs.run_build_pages == true) && !failure()}}
permissions:
pages: write # Required to deploy to GitHub Pages
id-token: write # Required to deploy to GitHub Pages
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
concurrency:
group: 'pages'
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{vars.PAGES_BRANCH}}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- run: pip install -r .github/workflows/requirements.txt
- name: Execute Python Script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python .github/workflows/combine_appfilter.py
- name: Move combinded Appfilter
run: mv combined_appfilter.xml docs/assets/combined_appfilter.xml
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload docs folder
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4