Skip to content

Commit 9088300

Browse files
authored
ci: commits from bot, show branch in check script (#5428)
1 parent 2d89eaf commit 9088300

14 files changed

+79
-42
lines changed

.github/workflows/check.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414

1515
steps:
1616
- uses: actions/checkout@master
17+
with:
18+
fetch-depth: 10
1719

1820
- name: Install Node dependencies
1921
run: yarn --frozen-lockfile
@@ -40,14 +42,35 @@ jobs:
4042
- name: Check Schema
4143
run: ./scripts/check-schema.sh
4244

43-
- name: Setup data
44-
run: yarn data
45+
- name: Setup Git remote
46+
run: ./scripts/setup-git-ci.sh
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Check and Commit
51+
run: ./scripts/check-and-commit.sh
52+
53+
toc:
54+
runs-on: ubuntu-latest
55+
56+
name: TOC
57+
58+
steps:
59+
- uses: actions/checkout@master
60+
with:
61+
fetch-depth: 10
62+
63+
- name: Install Node dependencies
64+
run: yarn --frozen-lockfile
4565

4666
- name: Setup Ruby
4767
uses: actions/setup-ruby@v1
4868
with:
4969
ruby-version: '2.x'
5070

71+
- name: Setup data
72+
run: yarn data
73+
5174
- name: Build Jekyll
5275
run: |
5376
gem install bundler
@@ -59,7 +82,10 @@ jobs:
5982
- name: Build TOC
6083
run: scripts/generate-toc
6184

62-
- name: Check and Commit
63-
run: ./scripts/check-and-commit.sh
85+
- name: Setup Git remote
86+
run: ./scripts/setup-git-ci.sh
6487
env:
6588
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
90+
- name: Check and Commit
91+
run: ./scripts/check-and-commit-toc.sh

scripts/build-example.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
dir=${dir-"examples/compiled"}
66

scripts/build-examples.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
# script for npm run x-compile
33

4-
set -e
4+
set -eo pipefail
55

66
dir=${dir-"examples/compiled"}
77

scripts/bump.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
if [ "$#" -ne 1 ]; then
66
echo "You must provide the new version to the script. The current version is $(./scripts/version.sh vega-lite)."

scripts/check-and-commit-toc.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
6+
git checkout $GIT_BRANCH
7+
8+
echo "On branch $GIT_BRANCH."
9+
10+
echo ""
11+
echo "------- Checking TOC -------"
12+
echo ""
13+
14+
# Commit the TOC if outdated
15+
if ! git diff --exit-code ./site/_includes/docs_toc.md
16+
then
17+
## Only do this for master
18+
if [[ $GIT_BRANCH == 'master' ]]; then
19+
echo "Outdated TOC."
20+
exit 1
21+
else
22+
git add ./site/_includes/docs_toc.md
23+
git commit -m "chore: update TOC [CI]"
24+
25+
# Push all the TOC changes
26+
git pull --rebase origin ${GITHUB_REF}
27+
git push origin ${GITHUB_REF}
28+
fi
29+
fi
30+
31+
exit 0

scripts/check-and-commit.sh

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

5-
scripts/setup-git-ci.sh
5+
GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
6+
git checkout $GIT_BRANCH
67

7-
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
8+
echo "On branch $GIT_BRANCH."
89

910
echo ""
1011
echo "------- Checking Schema -------"
@@ -23,28 +24,10 @@ then
2324
fi
2425
fi
2526

26-
echo ""
27-
echo "------- Checking TOC -------"
28-
echo ""
29-
30-
# Commit the TOC if outdated
31-
if ! git diff --exit-code ./site/_includes/docs_toc.md
32-
then
33-
## Only do this for master
34-
if [[ $GIT_BRANCH == 'master' ]]; then
35-
echo "Outdated TOC."
36-
exit 1
37-
else
38-
git add ./site/_includes/docs_toc.md
39-
git commit -m "chore: update TOC [CI]"
40-
fi
41-
fi
42-
4327
echo ""
4428
echo "------- Checking Examples -------"
4529
echo ""
4630

47-
4831
if git log -1 | grep "\[SVG\]" && [[ $GIT_BRANCH != 'master' ]]; then
4932
echo "As the latest commit includes [SVG]. Rebuilding all SVGs."
5033
yarn build:examples-full
@@ -72,7 +55,6 @@ else
7255
fi
7356
fi
7457

75-
7658
echo ""
7759
echo "------- Checking Code Formatting -------"
7860
echo ""
@@ -86,6 +68,7 @@ if [[ $GIT_BRANCH != 'master' ]]; then
8668
fi
8769

8870
# Then push all the changes (schema, examples, prettier)
71+
git pull --rebase origin ${GITHUB_REF}
8972
git push origin ${GITHUB_REF}
9073
fi
9174

scripts/check-npm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
# Check if all required files are here
66
if ! [ -f build/vega-lite.js ]; then

scripts/check-schema.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
if grep 'Generic[^U].*Spec<' ./build/vega-lite-schema.json
66
then

scripts/create-example-pages.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -ex
3+
set -euxo pipefail
44

55
rsync -r examples/specs/* site/examples/
66
rsync examples/compiled/*.svg site/examples/

scripts/deploy-schema.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -euo pipefail
44

55
version=$(scripts/version.sh vega-lite)
66

0 commit comments

Comments
 (0)