Skip to content

Commit

Permalink
fix the ci trigger action (#4805)
Browse files Browse the repository at this point in the history
* add some more diagnostics

* also print the log after fetching [skip-ci]

* try using the current ref to fetch and checkout the FETCH_HEAD

* add some more options and print the log before checkout

* don't add a progress report when printing to a file [skip-ci]

* add back the progress report but also use -q [skip-ci]

* replace the backticks with tt html tags [skip-ci]

* skip the auto-fetch within the action [skip-ci]
  • Loading branch information
keewis authored Jan 13, 2021
1 parent 747fe26 commit 3721725
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
<h3>
Overriding CI behaviors
</h3>
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 <tt>[test-upstream]</tt> tag to the first line of the commit message. For documentation-only commits, you can skip the CI per commit by adding a <tt>[skip-ci]</tt> tag to the first line of the commit message
</sub>
16 changes: 11 additions & 5 deletions .github/actions/detect-ci-trigger/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ event_name="$1"
keyword="$2"

echo "::group::fetch a sufficient number of commits"
if [[ "$event_name" == "pull_request" ]]; then
git fetch --deepen=1 --no-tags 2>&1
else
echo "nothing to do."
fi
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"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3721725

Please sign in to comment.