Skip to content

Initial Load of ThriftyLib 2024 #67

Initial Load of ThriftyLib 2024

Initial Load of ThriftyLib 2024 #67

Workflow file for this run

# This workflow runs the JSON checker on each vendordep JSON file.
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches: [ main ]
pull_request:
env:
YEAR: 2025
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "run-json-checker"
run-json-checker:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history so we can use git diff
- name: Install dependencies
run: sudo pip3 install pyelftools pefile
- name: Run check
run: |
# Determine the base commit
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch --no-tags --prune --progress --no-recurse-submodules origin ${{ github.base_ref }}
BASE_COMMIT=$(git merge-base HEAD origin/${{ github.base_ref }})
else
BASE_COMMIT=${{ github.event.before }}
fi
echo "Base commit: $BASE_COMMIT"
# Get list of added or modified JSON files in subdirectories
git diff --diff-filter=AM --name-only $BASE_COMMIT HEAD | grep '.*/.*\.json$' > changed_json_files.txt || true
# Run check.py on each existing JSON file
if [ -s changed_json_files.txt ]; then
# Output the list of files
echo "Changed JSON files in subdirectories:"
cat changed_json_files.txt
while read -r file; do
if [ -f "$file" ]; then
if [ -s "$file" ]; then
echo "Processing $file"
./check.py "$file"
else
echo "Warning: $file is empty."
fi
else
echo "Warning: $file does not exist."
fi
done < changed_json_files.txt
else
echo "No JSON files changed in subdirectories, checking year: $YEAR"
./check.py $YEAR/*.json
fi