Skip to content

Commit 6eb6cfb

Browse files
authored
Strip spaces and newlines from secret (GoogleCloudPlatform#5217)
## Description Based off conversation in PR GoogleCloudPlatform#5212, stripping the extra spaces/newlines from the secret can help prevent any issues Note: It's a good idea to open an issue first for discussion. ## Checklist - [ ] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md) - [ ] README is updated to include [all relevant information](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#readme-file) - [ ] **Tests** pass: `nox -s py-3.6` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] **Lint** pass: `nox -s lint` (see [Test Environment Setup](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md#test-environment-setup)) - [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones) - [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones) - [ ] Please **merge** this PR for me once it is approved. - [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/.github/CODEOWNERS) with the codeowners for this sample
1 parent 09e5ffe commit 6eb6cfb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

run/deployment-previews/check_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def github_token(project_id: str, ghtoken_secretname: str) -> str:
128128
error(e, context=f"finding secret {ghtoken_secretname}")
129129

130130
# The secret was encoded for you as part of the secret creation, so decode it now.
131-
github_token = response.payload.data.decode("UTF-8")
131+
github_token = response.payload.data.decode("UTF-8").strip()
132132
return github_token
133133

134134

0 commit comments

Comments
 (0)