From 47341441ee8a7ec1951e4b430264311880a4cd47 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 22:08:17 +0100 Subject: [PATCH 1/8] add some more diagnostics --- .github/actions/detect-ci-trigger/script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/detect-ci-trigger/script.sh b/.github/actions/detect-ci-trigger/script.sh index d54da9b7ef0..edc88cbed04 100644 --- a/.github/actions/detect-ci-trigger/script.sh +++ b/.github/actions/detect-ci-trigger/script.sh @@ -3,6 +3,7 @@ event_name="$1" keyword="$2" echo "::group::fetch a sufficient number of commits" +git log -n 5 2>&1 if [[ "$event_name" == "pull_request" ]]; then git fetch --deepen=1 --no-tags 2>&1 else From 1da547ec25fca596e595c2265ad27104d0baa386 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 22:39:42 +0100 Subject: [PATCH 2/8] also print the log after fetching [skip-ci] --- .github/actions/detect-ci-trigger/script.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/detect-ci-trigger/script.sh b/.github/actions/detect-ci-trigger/script.sh index edc88cbed04..599413c84f7 100644 --- a/.github/actions/detect-ci-trigger/script.sh +++ b/.github/actions/detect-ci-trigger/script.sh @@ -9,6 +9,7 @@ if [[ "$event_name" == "pull_request" ]]; then else echo "nothing to do." fi +git log -n 5 2>&1 echo "::endgroup::" echo "::group::extracting the commit message" From bae073e9f2ca67ecc0fe245590c297cf4d40f14e Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 23:33:05 +0100 Subject: [PATCH 3/8] try using the current ref to fetch and checkout the FETCH_HEAD --- .github/actions/detect-ci-trigger/script.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/detect-ci-trigger/script.sh b/.github/actions/detect-ci-trigger/script.sh index 599413c84f7..ab817c6f32d 100644 --- a/.github/actions/detect-ci-trigger/script.sh +++ b/.github/actions/detect-ci-trigger/script.sh @@ -5,7 +5,9 @@ keyword="$2" echo "::group::fetch a sufficient number of commits" git log -n 5 2>&1 if [[ "$event_name" == "pull_request" ]]; then - git fetch --deepen=1 --no-tags 2>&1 + ref=$(git log -1 --format='%H') + git -c protocol.version=2 fetch --deepen=2 --no-tags origin $ref 2>&1 + git checkout FETCH_HEAD else echo "nothing to do." fi From 0387adb3d11315f61257d1aeb266b55cc1914322 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 23:37:40 +0100 Subject: [PATCH 4/8] add some more options and print the log before checkout --- .github/actions/detect-ci-trigger/script.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/detect-ci-trigger/script.sh b/.github/actions/detect-ci-trigger/script.sh index ab817c6f32d..dbdda466849 100644 --- a/.github/actions/detect-ci-trigger/script.sh +++ b/.github/actions/detect-ci-trigger/script.sh @@ -6,7 +6,8 @@ echo "::group::fetch a sufficient number of commits" git log -n 5 2>&1 if [[ "$event_name" == "pull_request" ]]; then ref=$(git log -1 --format='%H') - git -c protocol.version=2 fetch --deepen=2 --no-tags origin $ref 2>&1 + git -c protocol.version=2 fetch --deepen=2 --no-tags --prune --progress origin $ref 2>&1 + git log FETCH_HEAD git checkout FETCH_HEAD else echo "nothing to do." From cc49e63680913924af20cb709342538b2f2ce253 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 23:43:22 +0100 Subject: [PATCH 5/8] don't add a progress report when printing to a file [skip-ci] --- .github/actions/detect-ci-trigger/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/detect-ci-trigger/script.sh b/.github/actions/detect-ci-trigger/script.sh index dbdda466849..c74292e501b 100644 --- a/.github/actions/detect-ci-trigger/script.sh +++ b/.github/actions/detect-ci-trigger/script.sh @@ -6,7 +6,7 @@ echo "::group::fetch a sufficient number of commits" git log -n 5 2>&1 if [[ "$event_name" == "pull_request" ]]; then ref=$(git log -1 --format='%H') - git -c protocol.version=2 fetch --deepen=2 --no-tags --prune --progress origin $ref 2>&1 + git -c protocol.version=2 fetch --deepen=2 --no-tags --prune origin $ref 2>&1 git log FETCH_HEAD git checkout FETCH_HEAD else From 91fd2365acbd4e6a3f1f5f0362af4813e7cca005 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 23:45:51 +0100 Subject: [PATCH 6/8] add back the progress report but also use -q [skip-ci] --- .github/actions/detect-ci-trigger/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/detect-ci-trigger/script.sh b/.github/actions/detect-ci-trigger/script.sh index c74292e501b..830e78028ea 100644 --- a/.github/actions/detect-ci-trigger/script.sh +++ b/.github/actions/detect-ci-trigger/script.sh @@ -6,7 +6,7 @@ echo "::group::fetch a sufficient number of commits" git log -n 5 2>&1 if [[ "$event_name" == "pull_request" ]]; then ref=$(git log -1 --format='%H') - git -c protocol.version=2 fetch --deepen=2 --no-tags --prune origin $ref 2>&1 + git -c protocol.version=2 fetch --deepen=2 --no-tags --prune --progress -q origin $ref 2>&1 git log FETCH_HEAD git checkout FETCH_HEAD else From f05b6f72e8de1ba5bee6b92dd78c8ca58bc5c93f Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 23:49:45 +0100 Subject: [PATCH 7/8] replace the backticks with tt html tags [skip-ci] --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 74f3fe2430f..09ef053bb39 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -11,5 +11,5 @@

Overriding CI behaviors

- By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a `[test-upstream]` tag to the first line of the commit message. For documentation-only commits, you can skip the CI per commit by adding a `[skip-ci]` tag to the first line of the commit message + By default, the upstream dev CI is disabled on pull request and push events. You can override this behavior per commit by adding a [test-upstream] tag to the first line of the commit message. For documentation-only commits, you can skip the CI per commit by adding a [skip-ci] tag to the first line of the commit message From 57cb7a3827e845bf1651a0aa477a11718726e4b1 Mon Sep 17 00:00:00 2001 From: Keewis Date: Wed, 13 Jan 2021 23:56:21 +0100 Subject: [PATCH 8/8] skip the auto-fetch within the action [skip-ci] --- .github/actions/detect-ci-trigger/script.sh | 21 +++++++++++---------- .github/workflows/ci-additional.yaml | 2 ++ .github/workflows/ci.yaml | 2 ++ .github/workflows/upstream-dev-ci.yaml | 2 ++ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/actions/detect-ci-trigger/script.sh b/.github/actions/detect-ci-trigger/script.sh index 830e78028ea..c98175a5a08 100644 --- a/.github/actions/detect-ci-trigger/script.sh +++ b/.github/actions/detect-ci-trigger/script.sh @@ -3,16 +3,17 @@ event_name="$1" keyword="$2" echo "::group::fetch a sufficient number of commits" -git log -n 5 2>&1 -if [[ "$event_name" == "pull_request" ]]; then - ref=$(git log -1 --format='%H') - git -c protocol.version=2 fetch --deepen=2 --no-tags --prune --progress -q origin $ref 2>&1 - git log FETCH_HEAD - git checkout FETCH_HEAD -else - echo "nothing to do." -fi -git log -n 5 2>&1 +echo "skipped" +# git log -n 5 2>&1 +# if [[ "$event_name" == "pull_request" ]]; then +# ref=$(git log -1 --format='%H') +# git -c protocol.version=2 fetch --deepen=2 --no-tags --prune --progress -q origin $ref 2>&1 +# git log FETCH_HEAD +# git checkout FETCH_HEAD +# else +# echo "nothing to do." +# fi +# git log -n 5 2>&1 echo "::endgroup::" echo "::group::extracting the commit message" diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 00f8ea42b97..fdc61f2f4f7 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -17,6 +17,8 @@ jobs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: - uses: actions/checkout@v2 + with: + fetch-depth: 2 - uses: ./.github/actions/detect-ci-trigger id: detect-trigger with: diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 849d8a445a5..7d7326eb5c2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -17,6 +17,8 @@ jobs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: - uses: actions/checkout@v2 + with: + fetch-depth: 2 - uses: ./.github/actions/detect-ci-trigger id: detect-trigger with: diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index bb325c1837e..6c04457a204 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -19,6 +19,8 @@ jobs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: - uses: actions/checkout@v2 + with: + fetch-depth: 2 - uses: ./.github/actions/detect-ci-trigger id: detect-trigger with: