Skip to content

[regex] made comment regex more permissive - #229

Open
G-ram wants to merge 6 commits into
webfactory:mainfrom
EfficientComputer:master
Open

G-ram wants to merge 6 commits into
webfactory:mainfrom
EfficientComputer:master

Conversation

@G-ram

@G-ram G-ram commented Nov 13, 2024

Copy link
Copy Markdown

This PR makes the regex expression for matching keys to repos more permissive, enabling the use of private github and gitlab servers.

@maelvls

maelvls commented Sep 12, 2025 •

Copy link
Copy Markdown

I second this! What can I do to move this forward?

misha-eff and others added 5 commits October 21, 2026 18:53
Match the repository URL in the key comment only (not the base64 key),
accepting git@<host>:<path>, https://<host>/<path> and
ssh://git@<host>[:<port>]/<path> with a dotted host and paths of two or
more segments. The host is lowercased and web page suffixes such as
/tree/main are dropped. A port is written to the generated ssh Host
block. Comments without such a URL are no longer treated as deploy keys,
which also fixes the crash in the bundled no-match log message.

Write the insteadOf rewrites with execFileSync, add unit tests run by
`npm test`, and bump @actions/core to 1.10.0 to match the bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On self-hosted runners that share $HOME between jobs, deploy-key
insteadOf rewrites written to the global git config by earlier jobs (of
any repository, with this action or webfactory/ssh-agent) stay there and
point to ssh Host aliases that no longer exist. git prefers them over
equally long rewrites of the current job, so clones fail.

At startup, remove all deploy-key rewrites from the global git config;
this is best effort and only warns on failure. Set the job's rewrites
through GIT_CONFIG_COUNT/GIT_CONFIG_KEY_<n>/GIT_CONFIG_VALUE_<n> instead,
keeping other entries already set there and replacing the deploy-key
rewrites of earlier invocations, whose keys are in an ssh-agent that is
no longer used. Deploy keys therefore need git 2.31, which is checked.
The post step only stops the agent, as upstream.

Build the key file and Host alias names in one place, skip appending an
ssh Host section that already exists, and document the limitations of
the environment-based settings and the updated Docker build recipe.

Test the config handling against git in an isolated config, and add a
demo job that plants stale rewrites, runs the action twice and checks
what git and ssh resolve on Linux, macOS and Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The clone demos need the deploy keys for upstream's mpdude/test-*
repositories, so their steps are skipped where those secrets are not
set, as in this fork. generated_keys_demo covers the action without
them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…teadof

ENG-2598: Set deploy-key rewrites in the job environment, clear stale ones; merge upstream (node24)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants