Skip to content

Build Stacks and Categories #8

Build Stacks and Categories

Build Stacks and Categories #8

Workflow file for this run

name: Build Stacks and Categories
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Runs at midnight UTC every day
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Verify and Prepare Scripts
run: |
if [[ ! -f "utils/build_stacks_array.sh" || ! -f "utils/build_categories_array.sh" ]]; then
echo "Error: Scripts missing in utils/ directory!"
exit 1
fi
chmod +x "utils/build_stacks_array.sh" "utils/build_categories_array.sh"
- name: Run Scripts and Check Outputs
run: |
set -e
"utils/build_stacks_array.sh" > "stacks/stacks.json"
"utils/build_categories_array.sh" > "stacks/categories.json"
for file in "stacks/stacks.json" "stacks/categories.json"; do
if [[ ! -s "$file" ]]; then
echo "Error: $file is empty or not updated!"
exit 1
fi
done
- name: Commit and Push Changes
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add "stacks/stacks.json" "stacks/categories.json"
git commit -m "Update stacks.json and categories.json"
git push