Fix sed token injection failing when secrets contain special characters#77
Open
Fix sed token injection failing when secrets contain special characters#77
Conversation
Agent-Logs-Url: https://github.com/ProLoser/funcheapmap/sessions/08f76937-db72-401e-8a2f-2c0917f88968 Co-authored-by: ProLoser <67395+ProLoser@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix the failing Deploy GitHub Actions job
Fix sed token injection failing when secrets contain special characters
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Secrets like
SENTRY_DSNare URL-shaped and contain/, which breakssed'ss/pattern/replacement/gsyntax at the delimiter boundary.Changes
/to||,&, and\— the three characters that are special in asedreplacement string when|is the delimitersed -i "s|__SENTRY_DSN__|$(printf '%s' "$SENTRY_DSN" | sed 's/[|&\\]/\\&/g')|g" index.html 19hz/index.htmlOriginal prompt
Fix the failing Deploy GitHub Actions job in repository
ProLoser/funcheapmap.Context:
.github/workflows/deploy.ymlInject tokensstep.sed: -e expression #1, char 25: unknown option to 's'Process completed with exit code 1.sed -i "s/.../${SECRET}/g" ...substitutions that inject secrets into files.Likely root cause:
/or other replacement metacharacters, causingsedsubstitution syntax to break. URL-like secrets such asSENTRY_DSNare especially likely.Requested solution:
.github/workflows/deploy.ymlso the token injection step works reliably even when secrets contain/,&,|, or other characters that would break naivesedreplacement.Acceptance criteria:
Inject tokensstep no longer fails due tosedreplacement syntax.__APIFY_TOKEN____GOOGLE_TOKEN____SPOTIFY_CLIENT_ID____SPOTIFY_CLIENT_SECRET____SENTRY_DSN__JamesIves/github-pages-deploy-action@v4.Please create a pull request with the fix.
The following is the prior conversation context from the user's chat exploration (may be truncated):
User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.
Assistant: The failure is in the token injection step of
.github/workflows/deploy.ymlat80aa1eefb1fa484457151a29cb45b64860e9de1a:.github/workflows/deploy.yml#L25-L30sed -i "s/.../${SECRET}/g" ...sed: -e expression #1, char 25: unknown option to 's'Cause: one of the secrets contains a
/or anothersedreplacement metacharacter, so the replacement string breaks thes/.../.../gexpression.SENTRY_DSNis especially likely because DSNs are URL-shaped.Use a non-slash delimiter and escape the replacement values before passing them to
sed.Suggested fix:
Minimal version, if you want to keep it tighter:
If you want the cleanest fix, replace the whole block at
.github/workflows/deploy.yml#L17-L30with the minimal version above. That directly addresses the failingsedsyntax and should make the deploy job pass.User: create a pr to fix it
Assistant: I’ve started the PR creation flow and we’re waiting for your approval in the Gi...
This pull request was created from Copilot chat.