This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
218 changed files
with
11,521 additions
and
7,616 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Copyright 2021 The Engula Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: "Set Skip Env Var" | ||
description: "Action to check whether we should skip CI jobs" | ||
inputs: | ||
paths-ignore: | ||
description: >- | ||
Output skip=true when and only when all of the changed files located in one of the path, | ||
the paths is shell-style pattern. | ||
required: false | ||
default: >- | ||
"*.md" | ||
"*.svg" | ||
paths: | ||
description: >- | ||
Output skip=true when and only when none of the changed files located in one of the path, | ||
the paths is shell-style pattern. | ||
required: false | ||
default: '' | ||
outputs: | ||
skip: | ||
description: "whether we should skip CI jobs" | ||
value: "${{ steps.check.outputs.skip }}" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Check Changed Files And Set Env Var | ||
id: check | ||
shell: bash | ||
run: | | ||
echo '::set-output name=skip::false' | ||
if [[ "${{ github.event_name }}" != "pull_request" ]]; then | ||
exit 0 | ||
fi | ||
BASE_SHA=$(jq -r '.pull_request.base.sha' $GITHUB_EVENT_PATH) | ||
echo "Base sha is $BASE_SHA, head sha is $GITHUB_SHA" | ||
git fetch --no-tags --progress --recurse-submodules --depth=1 origin ${BASE_SHA}:origin/${BASE_SHA} | ||
BASE_SHA=origin/${BASE_SHA} | ||
echo "Base sha is $BASE_SHA, head sha is $GITHUB_SHA" | ||
if ! files=$(git --no-pager diff --name-only ${GITHUB_SHA} ${BASE_SHA}); then | ||
exit 1 | ||
fi | ||
echo "Paths Ignore pattern:" | ||
for pattern in $(echo '${{ inputs.paths-ignore }}'); do | ||
echo $pattern | ||
done | ||
echo "Paths pattern:" | ||
for pattern in $(echo '${{ inputs.paths }}'); do | ||
echo $pattern | ||
done | ||
echo "Changed files:" | ||
for file in ${files}; do | ||
echo $file | ||
done | ||
echo "Checking paths-ignore..." | ||
ALL_IGNORE=1 | ||
for file in ${files}; do | ||
matched=0 | ||
for pattern in $(echo '${{ inputs.paths-ignore }}'); do | ||
pattern=$(echo "$pattern" | sed 's/"//g') | ||
if eval "[[ '$file' == $pattern ]]"; then | ||
matched=1 | ||
break | ||
fi | ||
done | ||
if [[ "$matched" == "0" ]]; then | ||
echo "$file doesn't match pattern $(echo '${{ inputs.paths-ignore }}'), stop checking" | ||
ALL_IGNORE=0 | ||
break | ||
fi | ||
done | ||
echo "Checking paths..." | ||
NONE_MATCH=1 | ||
for file in ${files}; do | ||
matched=0 | ||
for pattern in $(echo '${{ inputs.paths }}'); do | ||
pattern=$(echo "$pattern" | sed 's/"//g') | ||
if eval "[[ '$file' == $pattern ]]"; then | ||
matched=1 | ||
break | ||
fi | ||
done | ||
if [[ "$matched" == "1" ]]; then | ||
echo "$file match pattern $(echo '${{ inputs.paths }}'), stop checking" | ||
NONE_MATCH=0 | ||
break | ||
fi | ||
done | ||
echo "ALL_IGNORE: $ALL_IGNORE, NONE_MATCH: $NONE_MATCH" | ||
if [[ "$ALL_IGNORE" == "1" && "$NONE_MATCH" == "1" ]]; then | ||
echo "Set skip to true because all changed files are in paths-ignore and all changed files are not in paths." | ||
echo '::set-output name=skip::true' | ||
exit 0 | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.