Skip to content

Commit 3662c15

Browse files
committed
ci: address coderabbit review (DockerHub login guard + use $GITHUB_SHA)
1 parent c245e04 commit 3662c15

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

.github/actions/get-image-tag/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ runs:
2828
elif [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
2929
if [[ "${GITHUB_REF_NAME}" == infra-*-* ]]; then
3030
env=$(echo ${GITHUB_REF_NAME} | cut -d- -f2)
31-
sha=$(echo ${{ github.sha }} | head -c7)
31+
sha=$(echo "${GITHUB_SHA}" | head -c7)
3232
ts=$(date +%s)
3333
tag=${env}-${sha}-${ts}
3434
elif [[ "${GITHUB_REF_NAME}" == re2-*-* ]]; then
3535
env=$(echo ${GITHUB_REF_NAME} | cut -d- -f2)
36-
sha=$(echo ${{ github.sha }} | head -c7)
36+
sha=$(echo "${GITHUB_SHA}" | head -c7)
3737
ts=$(date +%s)
3838
tag=${env}-${sha}-${ts}
3939
elif [[ "${GITHUB_REF_NAME}" == v.docker.* ]]; then

.github/workflows/helm-prerelease.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ jobs:
112112
SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7)
113113
PRERELEASE_VERSION="${BASE_VERSION}-pr${PR_NUMBER}.${SHORT_SHA}"
114114
elif [[ "${{ github.event_name }}" == "push" ]]; then
115-
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
115+
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
116116
PRERELEASE_VERSION="${BASE_VERSION}-main.${SHORT_SHA}"
117117
else
118-
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
118+
SHORT_SHA=$(echo "${GITHUB_SHA}" | cut -c1-7)
119119
REF_SLUG=$(echo "${GITHUB_REF_NAME}" | tr '/' '-' | tr -cd 'a-zA-Z0-9-')
120120
if [[ -z "$REF_SLUG" ]]; then
121121
REF_SLUG="manual"

.github/workflows/publish-webapp.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: 🔢 Get the commit hash
4545
id: get_commit
4646
run: |
47-
echo "sha_short=$(echo ${{ github.sha }} | cut -c1-7)" >> "$GITHUB_OUTPUT"
47+
echo "sha_short=$(echo "${GITHUB_SHA}" | cut -c1-7)" >> "$GITHUB_OUTPUT"
4848
4949
- name: 📛 Set the tags
5050
id: set_tags
@@ -71,7 +71,7 @@ jobs:
7171
if [[ "${STEPS_GET_TAG_OUTPUTS_IS_SEMVER}" == true ]]; then
7272
echo "BUILD_APP_VERSION=${tag}"
7373
fi
74-
echo "BUILD_GIT_SHA=${{ github.sha }}"
74+
echo "BUILD_GIT_SHA=${GITHUB_SHA}"
7575
echo "BUILD_GIT_REF_NAME=${GITHUB_REF_NAME}"
7676
echo "BUILD_TIMESTAMP_SECONDS=$(date +%s)"
7777
} >> "$GITHUB_OUTPUT"

.github/workflows/publish-worker.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
runs-on: ubuntu-latest
3232
env:
3333
DOCKER_BUILDKIT: "1"
34+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
3435
steps:
3536
- name: ⬇️ Checkout git repo
3637
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -59,6 +60,7 @@ jobs:
5960

6061
# ..to avoid rate limits when pulling images
6162
- name: 🐳 Login to DockerHub
63+
if: ${{ env.DOCKERHUB_USERNAME }}
6264
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
6365
with:
6466
username: ${{ secrets.DOCKERHUB_USERNAME }}

0 commit comments

Comments
 (0)