Skip to content

Commit 15eb005

Browse files
committed
fix and test deploy check
1 parent 19c90c2 commit 15eb005

File tree

3 files changed

+28
-13
lines changed

3 files changed

+28
-13
lines changed

.github/workflows/push.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14+
15+
check:
16+
name: Check if result should be deployed
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- id: check
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
23+
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
24+
GIT_COMMITTER_EMAIL: ${{ secrets.PUSH_EMAIL }}
25+
run: bash ./tools/check-deploy-needed.sh
26+
1427
build-libs:
1528
name: Build Libs for ${{ matrix.target }}
1629
runs-on: ubuntu-latest

tools/check-deploy-needed.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,16 @@ echo "LIBS_VERSION: $LIBS_VERSION"
7070
echo "LIBS_HAS_COMMIT: $LIBS_HAS_COMMIT"
7171
echo "LIBS_HAS_BRANCH: $LIBS_HAS_BRANCH"
7272

73-
echo "idf_commit=$IDF_COMMIT" >> "$GITHUB_OUTPUT"
74-
echo "ar_branch=$AR_BRANCH" >> "$GITHUB_OUTPUT"
75-
echo "ar_new_commit_message=$AR_NEW_COMMIT_MESSAGE" >> "$GITHUB_OUTPUT"
76-
echo "ar_new_branch_name=$AR_NEW_BRANCH_NAME" >> "$GITHUB_OUTPUT"
77-
echo "ar_new_pr_title=$AR_NEW_PR_TITLE" >> "$GITHUB_OUTPUT"
78-
echo "ar_has_commit=$AR_HAS_COMMIT" >> "$GITHUB_OUTPUT"
79-
echo "ar_has_branch=$AR_HAS_BRANCH" >> "$GITHUB_OUTPUT"
80-
echo "ar_has_pr=$AR_HAS_PR" >> "$GITHUB_OUTPUT"
81-
echo "libs_version=$LIBS_VERSION" >> "$GITHUB_OUTPUT"
82-
echo "libs_has_commit=$LIBS_HAS_COMMIT" >> "$GITHUB_OUTPUT"
83-
echo "libs_has_branch=$LIBS_HAS_BRANCH" >> "$GITHUB_OUTPUT"
73+
if [ ! -x $GITHUB_OUTPUT ]; then
74+
echo "idf_commit=$IDF_COMMIT" >> "$GITHUB_OUTPUT"
75+
echo "ar_branch=$AR_BRANCH" >> "$GITHUB_OUTPUT"
76+
echo "ar_new_commit_message=$AR_NEW_COMMIT_MESSAGE" >> "$GITHUB_OUTPUT"
77+
echo "ar_new_branch_name=$AR_NEW_BRANCH_NAME" >> "$GITHUB_OUTPUT"
78+
echo "ar_new_pr_title=$AR_NEW_PR_TITLE" >> "$GITHUB_OUTPUT"
79+
echo "ar_has_commit=$AR_HAS_COMMIT" >> "$GITHUB_OUTPUT"
80+
echo "ar_has_branch=$AR_HAS_BRANCH" >> "$GITHUB_OUTPUT"
81+
echo "ar_has_pr=$AR_HAS_PR" >> "$GITHUB_OUTPUT"
82+
echo "libs_version=$LIBS_VERSION" >> "$GITHUB_OUTPUT"
83+
echo "libs_has_commit=$LIBS_HAS_COMMIT" >> "$GITHUB_OUTPUT"
84+
echo "libs_has_branch=$LIBS_HAS_BRANCH" >> "$GITHUB_OUTPUT"
85+
fi

tools/config.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ function github_commit_exists(){ #github_commit_exists <repo-path> <branch-name>
103103
local repo_path="$1"
104104
local branch_name="$2"
105105
local commit_message="$3"
106-
local commits_found=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/commits/?sha=$branch_name" | jq -r '.commit.message' | grep "$commit_message" | wc -l`
107-
if [ ! "$commits_found" == "" ] && [ ! "$commits_found" == "null" ] && [ ! "$commits_found" == "0" ]; then echo 1; else echo 0; fi
106+
local commits_found=`curl -s -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" "https://api.github.com/repos/$repo_path/commits?sha=$branch_name" | jq -r '.[].commit.message' | grep "$commit_message" | wc -l`
107+
if [ ! "$commits_found" == "" ] && [ ! "$commits_found" == "null" ] && [ ! "$commits_found" == "0" ]; then echo $commits_found; else echo 0; fi
108108
}
109109

110110
function github_last_commit(){ # github_last_commit <repo-path> <branch-name>

0 commit comments

Comments
 (0)