Skip to content

Update python-app.yml #31

Update python-app.yml

Update python-app.yml #31

Workflow file for this run

name: Test Mods
on:
push:
branches:
- main
pull_request:
schedule:
- cron: '0 20 * * 5' # Triggers every Friday at 20:00 UTC
jobs:
read-mod-list:
runs-on: ubuntu-latest
outputs:
mods: ${{ steps.get-mods.outputs.mods }}
steps:
# Checkout the repo to access mod_list.txt
- name: Checkout Code
uses: actions/checkout@v3
# Read the mod_list.txt and convert to JSON
- name: Parse Mod List
id: get-mods
run: |
mods=$(cat mod_list.txt | jq -R -s -c 'split("\n") | map(select(. != ""))')
echo "Parsed mods: $mods"
echo "mods=$mods" >> $GITHUB_OUTPUT
test-mods:
needs: read-mod-list
runs-on: ubuntu-latest
strategy:
matrix:
mod: ${{ fromJson(needs.read-mod-list.outputs.mods) }}
continue-on-error: true
steps:
# Checkout the repo
- name: Checkout Code
uses: actions/checkout@v4
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
# Install dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Extract the mod name (objectname) from the URL
- name: Extract Mod Name
id: extract-mod-name
run: |
url="${{ matrix.mod }}" # Use matrix.mod as the URL
if [ -n "$url" ]; then
mod_name=$(echo $url | sed 's:.*/::') # Extract the last segment after /
echo "Extracted mod name: $mod_name"
echo "mod_name=$mod_name" >> $GITHUB_ENV
else
echo "Error: URL is empty."
exit 1
fi
# Test each mod
- name: Checking Translation
run: |
echo "Running translation check for mod: ${{ env.mod_name }}"
python mod_translate_track.py "${{ matrix.mod }}" "${{ vars.LANGUAGE }}"
# Collect artifacts from the output/ directory
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: output-${{ env.mod_name }}
path: output/${{ env.mod_name }}/*