-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.56 KB
/
update_from_private.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
name: Update from Private Repo
on:
workflow_dispatch:
jobs:
update-public-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout public repository main branch
uses: actions/checkout@v3
with:
ref: main
- name: Clone private repository
# Must clone the directory into a file outside of where the current public repo is
# This prevents overlapping directory issue with rclone (exit code 7)
run: |
mkdir -p ../priavte-sds-repo
git clone https://sandesh-l:${{ secrets.PAT }}@github.com/access-ci-org/ACCESS-SDS.git ../private-sds-repo
- name: Install rclone
run: |
curl https://rclone.org/install.sh | sudo bash
- name: Sync files
# exclude the .git directory
# exclude the .github directory because it would overwrite this github action as well
# exclude readme. Since this is a public-facing repo, it will have a different readme with less technical info
# Remove the private-sds-repo directory just in case it tries to push that directory as well
run: |
rclone sync ../private-sds-repo/ . --exclude='.git/**' --exclude='.github/**' --exclude='README.md' --exclude='app/data/**'
rm -r ../private-sds-repo
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Update from private repo"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.PAT }}