-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (50 loc) · 1.77 KB
/
sync_template.yml
File metadata and controls
60 lines (50 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Sync with Template Repository
on:
#schedule:
# Run weekly on Monday at 9 AM UTC
# - cron: '0 9 * * 1'
workflow_dispatch:
# This enables to run a single workflow at a time
concurrency:
group: notebooks-global-lock-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
sync-template:
name: Sync with template repository
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Add upstream remote
run: |
git remote add upstream https://x-access-token:${{ secrets.SYNC_TOKEN }}@github.com/CellMigrationLab/LabConstrictor.git
# git remote add upstream https://github.com/CellMigrationLab/LabConstrictor.git
- name: Fetch upstream changes
run: |
git fetch upstream
- name: Fetch specific folders from upstream
run: |
set -euxo pipefail
# Checkout .github and .tools folders from upstream
git checkout upstream/main -- .github .tools
- name: Check for changes
id: check-changes
run: |
if git diff --cached --quiet; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check-changes.outputs.has_changes == 'true'
run: |
git commit -m "Sync .github and .tools with template repository"
git push origin main