StikDebug/.github/workflows/updatesource.yml
2026-07-31 20:40:19 -06:00

52 lines
1.6 KiB
YAML

name: Update StikDebug Source
on:
release:
types: [published]
workflow_dispatch:
jobs:
update-source:
runs-on: ubuntu-latest
steps:
- name: Checkout Website-Stuff
uses: actions/checkout@v6
with:
repository: StephenDev0/Website-Stuff
ref: main
path: Website-Stuff
# A repository-scoped GITHUB_TOKEN cannot push to Website-Stuff.
token: ${{ secrets.WEBSITE_STUFF_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Update StikDebug source
id: update_source
working-directory: Website-Stuff
run: |
git config --global user.name 'GitHub Action'
git config --global user.email 'action@github.com'
python updatesource.py index.json
git add index.json
if git diff --staged --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "No changes detected in index.json"
else
git commit -m "Update StikDebug source for latest release"
git push origin main
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Create job summary
run: |
if [[ "${{ steps.update_source.outputs.changes }}" == "true" ]]; then
echo "## StikDebug source updated" >> $GITHUB_STEP_SUMMARY
echo "Website-Stuff/index.json was updated and pushed." >> $GITHUB_STEP_SUMMARY
else
echo "## StikDebug source already current" >> $GITHUB_STEP_SUMMARY
echo "No change to Website-Stuff/index.json was needed." >> $GITHUB_STEP_SUMMARY
fi