forked from galaxyproject/training-material
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (85 loc) · 3.57 KB
/
git-gat.yml
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: "[CI] GIT-GAT"
on:
workflow_dispatch:
pull_request:
paths:
- 'topics/admin/**'
- 'bin/knit*'
push:
branches:
- main
paths:
- 'topics/admin/**'
- 'bin/knit*'
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/setup-python@v2
with:
python-version: '3.7'
architecture: 'x64'
- name: Export commits
run: |
bin/knit-automated.sh export;
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.GIT_GAT_SSH_KEY }}
known_hosts: "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ=="
if_key_exists: ignore # replace / ignore / fail; optional (defaults to fail)
if: github.event.pull_request.head.repo.full_name == 'galaxyproject/training-material' && github.event.pull_request.base.repo.full_name == 'galaxyproject/training-material'
- name: Setup the repo
run: |
cd /tmp/git-gat/
git config --global init.defaultBranch main
git init
git config user.email "[email protected]"
git config user.name "The Galaxy Training Network"
- name: Setup the origin (fork)
run: |
cd /tmp/git-gat/
git remote add origin https://github.com/hexylena/git-gat
if: github.event.pull_request.head.repo.full_name != 'galaxyproject/training-material' || github.event.pull_request.base.repo.full_name != 'galaxyproject/training-material'
- name: Setup the origin (branch)
run: |
cd /tmp/git-gat/
git remote add origin [email protected]:hexylena/git-gat
if: github.event.pull_request.head.repo.full_name == 'galaxyproject/training-material' && github.event.pull_request.base.repo.full_name == 'galaxyproject/training-material'
- name: Add scripts directory
run: |
cd /tmp/git-gat/
git fetch origin --tags
git add .scripts/
git commit -m "admin/init/0000: Add scripts directory"
git am 0-commit-0000-root-commit.patch
ls -al
- name: Commit the rounds of patches
run: |
cd /tmp/git-gat/
for i in {10..50}; do
# Commit those patches
patches=$(ls $i-*.patch 2>/dev/null| wc -c)
if (( patches > 0 )); then
git am -3 -C2 $i-*.patch;
# And tag it
git tag -f "step-$(( i - 9 ))";
fi
done
rm -f *.patch
ls -al
- name: Push the results
run: |
cd /tmp/git-gat/
# Push the results
git push -f -u origin main
today=$(date -I)
git checkout -b $today
git push -f --set-upstream origin $today
git push -f --tags
if: github.event.pull_request.head.repo.full_name == 'galaxyproject/training-material' && github.event.pull_request.base.repo.full_name == 'galaxyproject/training-material'
# TODO: figure out the logic aroudn checking branch name.
# && github.ref == 'refs/heads/main'