This repository includes a GitHub Actions workflow that automatically syncs contribution files to Firebase when they're added or modified.
When you add or modify a JSON file in the contributions/ directory and push to GitHub:
- GitHub Actions detects the change - The workflow triggers on pushes/PRs that modify files in
contributions/**/*.json - Script identifies changed files - Uses
git diffto find which files were added/modified - Files are synced to Firebase - Each file is loaded and saved to the appropriate Firebase collection
The sync script automatically handles these contribution types:
- Maneuvers (
contributions/maneuvers/) →game_data/maneuvers - Planets (
contributions/planets/) →game_data/planets - Races (
contributions/races/) →game_data/races - Starsigns (
contributions/starsigns/) →game_data/starsigns - Weapons (
contributions/weapons/) →game_data/weapons - Weapon Modifiers (
contributions/weapon_modifiers/) →game_data/weapon_modifiers - Rooms (
contributions/rooms/) →world/rooms - NPCs (
contributions/npcs/) →world/npcs - Items (
contributions/items/*/) →world/items - Shop Items (
contributions/shop_items/) →world/shop_items - Encounters (
contributions/encounters/) →config(zone tables and compositions; seedocs/random_encounters.md)
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click New repository secret
- Name:
FIREBASE_SERVICE_ACCOUNT - Value: Copy the entire contents of your
firebase-service-account.jsonfile (as a single-line JSON string)
Important: The value should be the JSON content as a string, not a file path. You can get it by running:
cat firebase-service-account.json | jq -cOr manually copy the entire JSON object and ensure it's on a single line.
You can test the sync script locally:
# Set environment variable
export FIREBASE_SERVICE_ACCOUNT='{"type":"service_account",...}'
# Run the sync script
python scripts/sync_contributions_to_firebase.pySimply add or modify JSON files in the contributions/ directory and push to GitHub. The workflow will automatically:
- Detect the changed files
- Validate the JSON structure
- Extract the appropriate ID field
- Save to Firebase
The workflow is defined in .github/workflows/sync-contributions.yml and runs:
- On pushes to
mainbranch whencontributions/**/*.jsonfiles change - On pull requests to
mainbranch whencontributions/**/*.jsonfiles change
- Check that files are actually in
contributions/directory - Verify files have
.jsonextension - Check GitHub Actions tab for workflow runs
- Verify
FIREBASE_SERVICE_ACCOUNTsecret is set correctly - Check that JSON files have the required ID field (e.g.,
maneuver_id,room_id) - Review workflow logs in GitHub Actions
- Ensure the file path matches one of the supported contribution directories
- Verify the JSON file has the correct ID field for its type
- Check that the file is valid JSON