Skip to content

Commit 4c70da4

Browse files
committed
Address review comments
1 parent 374c29b commit 4c70da4

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

.env

-4
This file was deleted.

.github/workflows/ci.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ on:
1212
jobs:
1313
ci:
1414
runs-on: ubuntu-latest
15+
env:
16+
MDBOOK_VERSION: 0.4.7
17+
MDBOOK_LINKCHECK_VERSION: 0.7.2
18+
MDBOOK_TOC_VERSION: 0.6.1
19+
DEPLOY_DIR: book/html
20+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
1521
steps:
1622
- uses: actions/checkout@v2
1723
with:
1824
# Set 0 to rebase later.
1925
fetch-depth: 0
2026

21-
- name: Read .env
22-
run: |
23-
. ./.env
24-
echo "MDBOOK_VERSION=${MDBOOK_VERSION}" >> $GITHUB_ENV
25-
echo "MDBOOK_LINKCHECK_VERSION=${MDBOOK_LINKCHECK_VERSION}" >> $GITHUB_ENV
26-
echo "MDBOOK_TOC_VERSION=${MDBOOK_TOC_VERSION}" >> $GITHUB_ENV
27-
echo "DEPLOY_DIR=${DEPLOY_DIR}" >> $GITHUB_ENV
28-
2927
- name: Cache binaries
3028
id: mdbook-cache
3129
uses: actions/cache@v2
@@ -42,7 +40,7 @@ jobs:
4240
key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}
4341

4442
- name: Check line lengths
45-
if: github.event_name != 'schedule'
43+
if: github.event_name != 'push'
4644
run: |
4745
shopt -s globstar
4846
MAX_LINE_LENGTH=100 bash ci/check_line_lengths.sh src/**/*.md
@@ -62,7 +60,7 @@ jobs:
6260
cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
6361
6462
- name: Check build
65-
if: github.event_name != 'schedule'
63+
if: github.event_name != 'push'
6664
run: |
6765
git switch -c ci
6866
git fetch origin master
@@ -71,7 +69,7 @@ jobs:
7169
mdbook build
7270
7371
- name: Deploy to gh-pages
74-
if: github.event_name == 'schedule' && github.repository == 'rust-lang/rustc-dev-guide'
72+
if: github.event_name == 'push' && github.repository == 'rust-lang/rustc-dev-guide'
7573
run: |
7674
mdbook build
7775
touch "${{ env.DEPLOY_DIR }}/.nojekyll"

ci/linkcheck.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job
1010
echo "Doing full link check."
1111
set -x
1212
elif [ "$CI" = "true" ] ; then # running in PR CI build
13+
if [ -z "$BASE_SHA" ]; then
14+
echo "error: unexpected state: BASE_SHA must be non-empty in CI"
15+
exit 1
16+
fi
1317

14-
CHANGED_FILES=$(git diff --name-only origin/master... | tr '\n' ' ')
18+
CHANGED_FILES=$(git diff --name-only $BASE_SHA... | tr '\n' ' ')
1519
FLAGS="--no-cache -f $CHANGED_FILES"
1620

17-
echo "Checking files changed in origin/master...: $CHANGED_FILES"
21+
echo "Checking files changed from $BASE_SHA: $CHANGED_FILES"
1822
set -x
1923
else # running locally
2024
COMMIT_RANGE=master...

0 commit comments

Comments
 (0)