Update Projects JSON #53
This file contains hidden or 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: Update Projects JSON | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
update-json: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install requests | |
- name: Update projects.json | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
run: python scripts/update_projects.py | |
- name: Check for changes | |
id: git_status | |
run: | | |
git diff --quiet public/projects.json || echo "changes=true" >> $GITHUB_OUTPUT | |
- name: Commit and push changes if needed | |
if: steps.git_status.outputs.changes == 'true' | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add public/projects.json | |
git commit -m 'Update projects.json with latest GitHub data' | |
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/AI4REALNET/.github.io.git | |
git push | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Trigger deployment workflow | |
if: steps.git_status.outputs.changes == 'true' | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
event-type: update-project-data |