mirror of
https://github.com/renovatebot/github-action.git
synced 2026-12-02 03:20:28 +00:00
feat!: change default user agent (#1107)
Co-authored-by: Claude Sonnet 5.5 <jamie.tanna+claude-code@mend.io>
This commit is contained in:
1 parent
3045e86700
commit
92712ddecd
2 files changed
+13
No files matched your search
@@ -437,6 +437,12 @@ For example if you wish to pass through some credentials for a [host rule](https
|
||||
};
|
||||
```
|
||||
|
||||
### User agent
|
||||
|
||||
By default, the Action sets [`RENOVATE_USER_AGENT`](https://docs.renovatebot.com/self-hosted-configuration/#useragent) to `Renovate/{{renovateVersion}} (https://github.com/renovatebot/github-action)`, so that operators of registries can identify traffic coming from this Action.
|
||||
|
||||
To override it, set the `RENOVATE_USER_AGENT` environment variable on the Action step.
|
||||
|
||||
### Passing other environment variables
|
||||
|
||||
There are two ways to pass additional variables through to the Renovate container:
|
||||
|
||||
@@ -6,6 +6,9 @@ import { Input } from './input';
|
||||
|
||||
export class Renovate {
|
||||
static dockerGroupRegex = /^docker:x:(?<groupId>[1-9][0-9]*):/m;
|
||||
private static readonly userAgentKey = 'RENOVATE_USER_AGENT';
|
||||
private static readonly defaultUserAgent =
|
||||
'Renovate/{{renovateVersion}} (https://github.com/renovatebot/github-action)';
|
||||
private configFileMountDir = '/github-action';
|
||||
|
||||
private docker: Docker;
|
||||
@@ -33,6 +36,10 @@ export class Renovate {
|
||||
.map((e) => `--env ${e.key}`)
|
||||
.concat([`--env ${this.input.token.key}=${this.input.token.value} --env FORCE_COLOR=3`]);
|
||||
|
||||
if (!this.input.toEnvironmentVariables().some((e) => e.key === Renovate.userAgentKey)) {
|
||||
dockerArguments.push(`--env "${Renovate.userAgentKey}=${Renovate.defaultUserAgent}"`);
|
||||
}
|
||||
|
||||
const configurationFile = this.input.configurationFile();
|
||||
if (configurationFile !== null) {
|
||||
const baseName = path.basename(configurationFile.value);
|
||||
|
||||
Reference in new issue
Block a user