Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Mar 2, 2021
1 parent 374c29b commit ddca529
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
4 changes: 0 additions & 4 deletions .env

This file was deleted.

20 changes: 9 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@ on:
jobs:
ci:
runs-on: ubuntu-latest
env:
MDBOOK_VERSION: 0.4.7
MDBOOK_LINKCHECK_VERSION: 0.7.2
MDBOOK_TOC_VERSION: 0.6.1
DEPLOY_DIR: book/html
BASE_SHA: ${{ github.event.pull_request.base.sha }}
steps:
- uses: actions/checkout@v2
with:
# Set 0 to rebase later.
fetch-depth: 0

- name: Read .env
run: |
. ./.env
echo "MDBOOK_VERSION=${MDBOOK_VERSION}" >> $GITHUB_ENV
echo "MDBOOK_LINKCHECK_VERSION=${MDBOOK_LINKCHECK_VERSION}" >> $GITHUB_ENV
echo "MDBOOK_TOC_VERSION=${MDBOOK_TOC_VERSION}" >> $GITHUB_ENV
echo "DEPLOY_DIR=${DEPLOY_DIR}" >> $GITHUB_ENV
- name: Cache binaries
id: mdbook-cache
uses: actions/cache@v2
Expand All @@ -42,7 +40,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}

- name: Check line lengths
if: github.event_name != 'schedule'
if: github.event_name != 'push'
run: |
shopt -s globstar
MAX_LINE_LENGTH=100 bash ci/check_line_lengths.sh src/**/*.md
Expand All @@ -62,7 +60,7 @@ jobs:
cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
- name: Check build
if: github.event_name != 'schedule'
if: github.event_name != 'push'
run: |
git switch -c ci
git fetch origin master
Expand All @@ -71,7 +69,7 @@ jobs:
mdbook build
- name: Deploy to gh-pages
if: github.event_name == 'schedule' && github.repository == 'rust-lang/rustc-dev-guide'
if: github.event_name == 'push' && github.repository == 'rust-lang/rustc-dev-guide'
run: |
mdbook build
touch "${{ env.DEPLOY_DIR }}/.nojekyll"
Expand Down
8 changes: 6 additions & 2 deletions ci/linkcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ if [ "$GITHUB_EVENT_NAME" = "schedule" ] ; then # running in scheduled job
echo "Doing full link check."
set -x
elif [ "$CI" = "true" ] ; then # running in PR CI build
if [ -z "$BASE_SHA" ]; then
echo "error: unexpected state: BASE_SHA must be non-empty in CI"
exit 1
fi

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

echo "Checking files changed in origin/master...: $CHANGED_FILES"
echo "Checking files changed in $BASE_SHA...$GITHUB_SHA: $CHANGED_FILES"
set -x
else # running locally
COMMIT_RANGE=master...
Expand Down

0 comments on commit ddca529

Please sign in to comment.