Skip to content

Commit 8fb45cb

Browse files
committed
Updated workflows
1 parent db001d2 commit 8fb45cb

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

.github/workflows/auto-deploy.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
branches: [ main ]
55
workflow_dispatch:
6+
repository_dispatch:
7+
types: [update-project-data]
68

79
jobs:
810
build-and-deploy:
@@ -36,4 +38,4 @@ jobs:
3638
with:
3739
folder: dist
3840
branch: gh-pages
39-
clean: true
41+
clean: true

.github/workflows/refresh-data.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,26 @@ jobs:
2626
GH_TOKEN: ${{ secrets.GH_TOKEN }}
2727
run: python scripts/update_projects.py
2828

29+
- name: Check for changes
30+
id: git_status
31+
run: |
32+
git diff --quiet public/projects.json || echo "changes=true" >> $GITHUB_OUTPUT
33+
2934
- name: Commit and push changes if needed
35+
if: steps.git_status.outputs.changes == 'true'
3036
run: |
3137
git config --global user.name 'github-actions[bot]'
3238
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
33-
git diff --exit-code || (git add public/projects.json && git commit -m 'Update projects.json with latest GitHub data' && \
34-
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/AI4REALNET/.github.io.git && \
35-
git push)
39+
git add public/projects.json
40+
git commit -m 'Update projects.json with latest GitHub data'
41+
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/AI4REALNET/.github.io.git
42+
git push
3643
env:
37-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
44+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
45+
46+
- name: Trigger deployment workflow
47+
if: steps.git_status.outputs.changes == 'true'
48+
uses: peter-evans/repository-dispatch@v2
49+
with:
50+
token: ${{ secrets.GH_TOKEN }}
51+
event-type: update-project-data

0 commit comments

Comments
 (0)