Skip to content

Commit 24d8cc9

Browse files
fix: improve handling of GitHub token by removing newline characters
1 parent d299790 commit 24d8cc9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.github/workflows/container-build.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ jobs:
4646
file: container/Dockerfile
4747
push: true
4848
platforms: linux/amd64
49+
# Optionally replace secrets.GITHUB_TOKEN with a PAT (use the same
50+
# secret name or adjust this mapping) to avoid API rate limits when
51+
# the pipeline fetches data for many repositories.
4952
secrets: |
50-
# Optionally replace secrets.GITHUB_TOKEN with a PAT (store it under the same secret name
51-
# or adjust this mapping) to avoid 401 responses and heavy rate limiting when the pipeline
52-
# fetches metadata for thousands of modules.
5353
github_token=${{ secrets.GITHUB_TOKEN }}
5454
tags: ${{ steps.meta.outputs.image }}

container/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ git config --global --add safe.directory /workspace
1717
git log -1
1818
TOKEN_FILE="/run/secrets/github_token"
1919
if [ -f "$TOKEN_FILE" ]; then
20-
GITHUB_TOKEN_VALUE="$(cat "$TOKEN_FILE")"
20+
GITHUB_TOKEN_VALUE="$(tr -d '\r\n' < "$TOKEN_FILE")"
2121
if [ -n "$GITHUB_TOKEN_VALUE" ]; then
2222
export GITHUB_TOKEN="$GITHUB_TOKEN_VALUE"
2323
fi

0 commit comments

Comments
 (0)