Skip to content

Commit caab453

Browse files
committed
ci: add script to automatically update the project from upstream every day
1 parent b1a3bd5 commit caab453

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ jobs:
8080
cancel-in-progress: true
8181
needs:
8282
- check_if_version_upgraded
83+
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true'
8384
env:
8485
TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }}
8586
steps:
@@ -105,6 +106,7 @@ jobs:
105106
needs:
106107
- trigger_pre_production_deploy
107108
- check_if_version_upgraded
109+
if: needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true'
108110
env:
109111
TO_VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }}
110112
steps:

.github/workflows/sync-upstream.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Sync upstream
2+
3+
on:
4+
schedule:
5+
- cron: '0 7 * * *' # every day at 7 AM UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
sync:
10+
name: Sync repository with upstream repository
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout fork
14+
uses: actions/checkout@v4
15+
with:
16+
token: ${{ secrets.PAT_FOR_UPSTREAM_SYNC }}
17+
fetch-depth: 0
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "github-actions[bot]"
22+
git config user.email "github-actions[bot]@users.noreply.github.com"
23+
24+
- name: Add upstream remote
25+
run: |
26+
git remote add upstream https://github.com/codegouvfr/sill.git
27+
git fetch upstream
28+
29+
- name: Sync with upstream/main
30+
run: |
31+
git checkout main
32+
git rebase upstream/main
33+
34+
- name: Push to origin
35+
run: git push origin main --force-with-lease --no-verify

0 commit comments

Comments
 (0)