Skip to content

Commit

Permalink
Merge pull request #15 from tuanngocptn/main
Browse files Browse the repository at this point in the history
chore: add check run config_github_token
  • Loading branch information
tuanngocptn authored Jan 23, 2024
2 parents 4fab25e + 7fc629b commit 5b25fb3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
12 changes: 8 additions & 4 deletions index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ health_check() {
}

config_github_token() {
REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git remote add publisher $REMOTE_REPO || true
git config user.name "GitHub Actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ $(git config user.email) == '41898282+github-actions[bot]@users.noreply.github.com'* ]]; then
echo "Already config github token"
else
REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git remote add publisher $REMOTE_REPO || true
git config user.name "GitHub Actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
fi
}
split_version() {
TAG_NAME=$1
Expand Down
12 changes: 8 additions & 4 deletions src/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ health_check() {
}

config_github_token() {
REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git remote add publisher $REMOTE_REPO || true
git config user.name "GitHub Actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ $(git config user.email) == '41898282+github-actions[bot]@users.noreply.github.com'* ]]; then
echo "Already config github token"
else
REMOTE_REPO="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git remote add publisher $REMOTE_REPO || true
git config user.name "GitHub Actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
fi
}

0 comments on commit 5b25fb3

Please sign in to comment.