-
Notifications
You must be signed in to change notification settings - Fork 3
212 lines (195 loc) · 7.46 KB
/
update.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Update revisions and PRs
on:
schedule:
# Every 30 minutes
- cron: '*/30 * * * *'
push:
branch: master
jobs:
build:
runs-on: ubuntu-latest
concurrency: build
steps:
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: "3.x"
# ==== Bootstrap for history update ====
- name: Get gh-pages hash
run: |
curl \
--url https://api.github.com/repos/${{ github.repository }}/branches/gh-pages \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' | \
python -c 'import sys; import json; print("##[set-output name=sha;]{}".format(json.loads(sys.stdin.read())["commit"]["sha"]))'
id: pages_hash
- name: Download gh-pages Bootstrap
run: |
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/Makefile
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/build.py
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/config.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/broken_revs.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/history/revs.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/history/prs.json
curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.pages_hash.outputs.sha}}/requirements.txt
mkdir -p history
mv revs.json history
mv prs.json history
- name: Setup virtualenv
run: make py-venv-bootstrap
- name: Run gh-pages Bootstrap
run: make bootstrap
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
id: pages_bootstrap
- name: Remove gh-pages Bootstrap
run: |
rm Makefile
rm build.py
rm config.json
rm broken_revs.json
rm -rf history
rm requirements.txt
# ==== Bootstrap for posting PR status ====
#- name: Get pr-status hash
# run: |
# curl \
# --url https://api.github.com/repos/${{ github.repository }}/branches/pr-status \
# --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
# --header 'content-type: application/json' | \
# python -c 'import sys; import json; print("##[set-output name=sha;]{}".format(json.loads(sys.stdin.read())["commit"]["sha"]))'
# id: status_hash
#- name: Download pr-status Bootstrap
# run: |
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/Makefile
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/build.py
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/config.json
# curl -O https://raw.githubusercontent.com/${{github.repository}}/${{steps.status_hash.outputs.sha}}/pr-status.json
#- name: Run pr-status Bootstrap
# run: make bootstrap
# id: status_bootstrap
#- name: Remove pr-status Bootstrap
# run: |
# rm Makefile
# rm build.py
# rm config.json
# rm pr-status.json
# ==== Checkout if history or PR status needs to be updated ====
- name: Checkout
#if: steps.pages_bootstrap.outputs.update == 'Yes' || steps.status_bootstrap.outputs.update == 'Yes'
if: steps.pages_bootstrap.outputs.update == 'Yes'
uses: actions/checkout@v1
with:
ref: gh-pages
- name: Set Git Profile
#if: steps.pages_bootstrap.outputs.update == 'Yes' || steps.status_bootstrap.outputs.update == 'Yes'
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Setup virtualenv
#if: steps.pages_bootstrap.outputs.update == 'Yes' || steps.status_bootstrap.outputs.update == 'Yes'
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: make py-venv
# ==== Post PR status for previous update ====
#- name: Checkout pr-status
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: |
# git checkout pr-status
#### disable for now
#- name: Post PR status
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: make post
# env:
# POST_TOKEN: ${{secrets.POST_TOKEN}}
#- name: Commit PR status JSON
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: |
# git add pr-status.json
# set +e
# git diff --cached --quiet
# echo "##[set-output name=modified;]$?"
# set -e
# id: status_post
#- name: Commit PR status JSON
# if: steps.status_post.outputs.modified == '1'
# run: |
# git commit -m "Post PR status"
#- name: Push PR status JSON changes
# if: steps.status_post.outputs.modified == '1'
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: pr-status
# force: false
#- name: Checkout gh-pages
# if: steps.status_bootstrap.outputs.update == 'Yes'
# run: |
# git checkout gh-pages
# ==== Update history ====
- name: Clone ecma262
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: make clone
- name: Update revisions
if: steps.pages_bootstrap.outputs.update_revs == 'Yes'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: make update5
- name: Update PRs
if: steps.pages_bootstrap.outputs.update_prs == 'Yes'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: make pr5
id: prs
- name: Add history
if: steps.pages_bootstrap.outputs.update == 'Yes'
run: |
git add history
git add broken_revs.json
set +e
git diff --cached --quiet
echo "##[set-output name=modified;]$?"
set -e
id: pages_add
- name: Commit history
if: steps.pages_add.outputs.modified == '1'
run: |
git commit -m "update history"
- name: Push history changes
if: steps.pages_add.outputs.modified == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: false
# ==== Store PR status data for the next run ====
- name: Checkout pr-status
if: steps.prs.outputs.updated_pr_list != ''
run: |
git checkout pr-status
- name: Store PR status data
if: steps.prs.outputs.updated_pr_list != ''
run: make store
env:
UPDATED_PR_LIST: ${{ steps.prs.outputs.updated_pr_list }}
POST_TOKEN: ${{secrets.POST_TOKEN}}
- name: Add PR status JSON
if: steps.prs.outputs.updated_pr_list != ''
run: |
git add pr-status.json
set +e
git diff --cached --quiet
echo "##[set-output name=modified;]$?"
set -e
id: status_add
- name: Commit PR status JSON
if: steps.status_add.outputs.modified == '1'
run: |
git commit -m "Store PR status"
- name: Push PR status JSON changes
if: steps.status_add.outputs.modified == '1'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: pr-status
force: false