From 17241639624905671208118e3425dc440969d531 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Mon, 24 Aug 2020 11:01:49 -0700 Subject: [PATCH] Ensure exit code on git diff can cause failure as well --- .ci/check-pr-no-readme.sh | 3 ++- .github/workflows/ci.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.ci/check-pr-no-readme.sh b/.ci/check-pr-no-readme.sh index 6ffe4f25b..1a8561056 100755 --- a/.ci/check-pr-no-readme.sh +++ b/.ci/check-pr-no-readme.sh @@ -4,7 +4,8 @@ set -Eeuo pipefail cd "$(dirname "$(readlink -f "$BASH_SOURCE")")/.." git fetch -q https://github.com/docker-library/docs.git master -if [ -n "$(git diff --numstat FETCH_HEAD...HEAD -- '*/README.md')" ]; then +numstat="$(git diff --numstat FETCH_HEAD...HEAD -- '*/README.md')" +if [ -n "$numstat" ]; then echo >&2 'Error: at least one repo README.md has changed' echo >&2 'These files are autogenerated, so it is unnecessary to modify them' echo >&2 'Please update content.md and docker-library-bot will take care of README.md' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c42274bd..a5c91502e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,5 +39,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - run: .ci/check-pr-no-readme.sh if: ${{ github.event_name == 'pull_request' }}