build: ignores json files in packaging #286
Workflow file for this run
This file contains 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: PR Checks | |
on: | |
pull_request: | |
branches: | |
- main | |
merge_group: | |
types: | |
- checks_requested | |
permissions: | |
contents: read | |
jobs: | |
check_translations: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.13 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.8.5 | |
- name: Install dependencies | |
run: poetry install | |
- name: Run translation check script | |
run: poetry run python .scripts/missing_translation_check.py | |
- name: Check for Hard-coded strings | |
run: poetry run python .scripts/hardcode_string_check.py | |
- name: Run missing locale keys script | |
run: poetry run python .scripts/check_for_missing_locale_keys.py | |
run_tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: leafo/gh-actions-lua@v10 | |
with: | |
luaVersion: 5.3.5 | |
- uses: leafo/gh-actions-luarocks@v4 | |
with: | |
luarocksVersion: 3.11.1 | |
- name: Install luarock dependencies | |
run: luarocks make --local rpglootfeed-1-1.rockspec | |
- name: Run Tests | |
run: make test-ci | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: luacov-html | |
path: luacov-html/ | |
test_package: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
env: | |
IS_FORK: ${{ github.event.pull_request.head.repo.fork }} | |
permissions: | |
actions: write | |
pull-requests: write | |
steps: | |
- name: Checkout code | |
if: env.IS_FORK == 'false' | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 0 | |
- name: Checkout code (fork) | |
if: env.IS_FORK == 'true' | |
uses: actions/checkout@v4 | |
- name: Fetch Latest Release Assets | |
id: fetch-release-assets | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
nolib_size=$(gh release view --json assets -q '.assets[] | select(.name | endswith("nolib.zip")) | .size') | |
echo "$nolib_size" | |
lib_size=$(gh release view --json assets -q '.assets[] | select(.name | endswith(".zip") and contains("nolib") | not) | .size') | |
echo "$lib_size" | |
echo "LATEST_RELEASE_NOLIB_SIZE=$nolib_size" >> $GITHUB_ENV | |
echo "LATEST_RELEASE_LIBS_SIZE=$lib_size" >> $GITHUB_ENV | |
- uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: subversion | |
version: test_package_apt_cache | |
- name: Package | |
if: env.IS_FORK == 'false' | |
uses: BigWigsMods/packager@v2 | |
with: | |
args: -d | |
pandoc: "false" | |
- name: Package (fork) | |
if: env.IS_FORK == 'true' | |
uses: BigWigsMods/packager@v2 | |
with: | |
args: -d -n {package-name}-pr${{github.event.number}}-{nolib}{classic} | |
pandoc: "false" | |
- name: Capture Filenames | |
id: capture-filenames | |
run: | | |
FILE1=$(ls .release/RPGLootFeed-*-nolib.zip) | |
FILE2=$(ls .release/RPGLootFeed-*.zip | grep -v 'nolib') | |
echo "FILE1=$FILE1" >> $GITHUB_ENV | |
echo "FILE2=$FILE2" >> $GITHUB_ENV | |
echo "TEST_NOLIB_SIZE=$(stat -c%s "$FILE1")" >> $GITHUB_ENV | |
echo "TEST_LIBS_SIZE=$(stat -c%s "$FILE2")" >> $GITHUB_ENV | |
- name: Upload RPGLootFeed ZIP | |
uses: actions/upload-artifact@v4 | |
id: upload-zips-standard | |
with: | |
name: pr-pkg | |
path: ${{ env.FILE2 }} | |
- name: Upload RPGLootFeed Nolib ZIP | |
uses: actions/upload-artifact@v4 | |
id: upload-zips-nolib | |
with: | |
name: pr-pkg-nolib | |
path: ${{ env.FILE1 }} | |
- name: Post PR comment | |
if: env.IS_FORK == 'false' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const script = require('./.scripts/post-pkg-comment.js'); | |
await script({ | |
github, | |
context, | |
libsUrl: "${{ steps['upload-zips-standard'].outputs.artifact-url }}", | |
noLibUrl: "${{ steps['upload-zips-nolib'].outputs.artifact-url }}", | |
latestReleaseStandardSize: process.env.LATEST_RELEASE_LIBS_SIZE, | |
testPkgStandardSize: process.env.TEST_LIBS_SIZE, | |
latestReleaseNoLibSize: process.env.LATEST_RELEASE_NOLIB_SIZE, | |
testPkgNoLibSize: process.env.TEST_NOLIB_SIZE | |
}); | |
commitlint: | |
runs-on: ubuntu-latest | |
env: | |
TITLE: ${{ github.event.pull_request.title }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Install commitlint | |
run: | | |
npm install @commitlint/config-angular @commitlint/cli | |
echo "export default {extends: ['@commitlint/config-angular']};" > commitlint.config.js | |
- name: Run commitlint (PR) | |
if: ${{ github.event_name == 'pull_request' }} | |
run: echo "${TITLE}" | npx commitlint | |
- name: Run commitlint (Merge Group) | |
if: ${{ github.event_name == 'merge_group' }} | |
run: npx commitlint --last | |
all_pr_checks: | |
name: Passing PR Checks | |
runs-on: ubuntu-latest | |
if: always() | |
needs: [check_translations, run_tests, test_package, commitlint] | |
steps: | |
- name: Export needs results as JSON | |
id: export-needs | |
run: echo '${{ toJSON(needs) }}' > needs.json | |
- name: Check if all jobs passed or were skipped | |
run: | | |
needs=$(cat needs.json) | |
for job in $(echo "$needs" | jq -r 'keys[]'); do | |
result=$(echo "$needs" | jq -r ".\"$job\".result") | |
if [[ "$result" != "success" && "$result" != "skipped" ]]; then | |
echo "Job $job failed." | |
exit 1 | |
fi | |
done | |
echo "All jobs passed or were skipped." | |
shell: bash |