generated from jhudsl/AnVIL_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (80 loc) · 2.87 KB
/
anvil-library-build.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
name: AnVIL Library Build
on:
workflow_call:
inputs:
render-type:
required: true
type: string
repository:
type: string
required: true
secrets:
gh_pat:
required: true
jobs:
gather-anvil-repos:
name: Gather AnVIL Repositories
runs-on: ubuntu-latest
container:
image: jhudsl/course_template:main
steps:
- name: Checkout files
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.gh_pat }}
- name: Configure git
run: |
git config --local user.email "itcrtrainingnetwork@gmail.com"
git config --local user.name "jhudsl-robot"
shell: bash
- name: Merge if rendering preview
if: ${{ inputs.render-type == 'preview' }}
run: |
branch_name='preview-${{ github.event.pull_request.number }}'
git fetch --all
git checkout $branch_name
git merge -s recursive --strategy-option=theirs origin/${{ github.head_ref }} --allow-unrelated-histories
shell: bash
- name: Checkout if main
if: ${{ inputs.render-type == 'main' }}
run: |
git fetch --all
git checkout main
shell: bash
- name: Run AnVIL repo check
id: anvil_repos
env:
GH_PAT: ${{ secrets.gh_pat }}
run: |
sudo apt-get install libcurl4-openssl-dev
# Need a clean render of the AnVIL repos library
rm -f resources/AnVIL_repos.tsv
rm -f docs/index.html
# Run repo check script
Rscript --vanilla "scripts/anvil_repo_check.R" --git_pat "$GH_PAT"
- name: Archive AnVIL repos
uses: actions/upload-artifact@v2
with:
name: anvil-repo-results
path: resources/AnVIL_repos.tsv
# Commit the rendered bookdown files
- name: Commit AnVIL Repos file to main
if: ${{ inputs.render-type == 'main' }}
env:
GH_PAT: ${{ secrets.gh_pat }}
run: |
git add --force resources/AnVIL_repos.tsv
git commit -m 'add AnVIL repos' || echo "No changes to commit"
git fetch
git merge -s recursive --strategy-option=ours origin/main --allow-unrelated-histories
git push -u origin main || echo "No changes to push"
- name: Commit AnVIL Repos file to preview
if: ${{ inputs.render-type == 'preview' }}
run: |
branch_name='preview-${{ github.event.pull_request.number }}'
git add --force resources/AnVIL_repos.tsv || echo "No changes to commit"
git commit -m 'Add AnVIL repos file' || echo "No changes to commit"
git fetch
git merge -s recursive --strategy-option=theirs origin/${{ github.head_ref }} --allow-unrelated-histories
git push --force origin $branch_name || echo "No changes to commit"