purifications #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: WikiWire | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'modules/**' | |
| - 'modules/*' | |
| - 'templates/**' | |
| - 'templates/*' | |
| jobs: | |
| wikiwire: | |
| runs-on: ubuntu-latest | |
| name: Sync files to production MediaWiki | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Darklua | |
| run: | | |
| wget -q https://github.com/seaofvoices/darklua/releases/download/v0.18.0/darklua-linux-x86_64.zip | |
| unzip -q darklua-linux-x86_64.zip | |
| chmod +x darklua | |
| - name: Regenerate Lua outputs for changed Luau modules | |
| shell: bash | |
| env: | |
| BEFORE: ${{ github.event.before }} | |
| AFTER: ${{ github.sha }} | |
| run: | | |
| set -euo pipefail | |
| if [[ -z "${BEFORE:-}" || "${BEFORE}" =~ ^0+$ ]]; then | |
| changed_files="$(git show --name-only --pretty=format: "${AFTER}")" | |
| else | |
| changed_files="$(git diff --name-only "${BEFORE}" "${AFTER}")" | |
| fi | |
| while IFS= read -r path; do | |
| [[ -n "$path" ]] || continue | |
| [[ "$path" == modules/* ]] || continue | |
| [[ "$path" =~ \.module\.luau$ ]] || continue | |
| out_path="${path%.module.luau}.module.lua" | |
| mkdir -p "$(dirname "$out_path")" | |
| ./darklua process --config .darklua.json5 "$path" "$out_path" | |
| done <<< "$changed_files" | |
| - name: Fail if outputs were not committed | |
| run: git diff --exit-code | |
| - name: WikiWire uploads Darklua .lua only (not Luau sources) | |
| shell: bash | |
| run: | | |
| touch .wikiwireignore | |
| grep -qxF '**/*.module.luau' .wikiwireignore || echo '**/*.module.luau' >> .wikiwireignore | |
| - uses: obbywiki/wikiwire@4989b61661fdd188479c7f2283b9ddde25337efa | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.WIKIWIRE_GITHUB_TOKEN }} | |
| with: | |
| username: WikiWireBot@WikiWire | |
| password: ${{ secrets.WIKIWIRE_PASSWORD }} | |
| dark_lua_compat: "false" |