mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-16 17:02:36 +00:00
feat: allow override env regex (#692)
This commit is contained in:
parent
5f40203468
commit
62d65f0924
3 changed files with 32 additions and 1 deletions
24
README.md
24
README.md
|
|
@ -161,6 +161,30 @@ module.exports = {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Passing other environment variables
|
||||||
|
|
||||||
|
If you want to pass other variables to the Docker container use the `env-regex` input to override the regular expression that is used to allow environment variables.
|
||||||
|
|
||||||
|
In your workflow pass the environment variable and whitelist it by specifying the `env-regex`:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
....
|
||||||
|
jobs:
|
||||||
|
renovate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3.3.0
|
||||||
|
- name: Self-hosted Renovate
|
||||||
|
uses: renovatebot/github-action@v34.82.0
|
||||||
|
with:
|
||||||
|
configurationFile: example/renovate-config.js
|
||||||
|
token: ${{ secrets.RENOVATE_TOKEN }}
|
||||||
|
env-regex: "^(?:RENOVATE_\\w+|LOG_LEVEL|GITHUB_COM_TOKEN|NODE_OPTIONS|AWS_TOKEN)$"
|
||||||
|
env:
|
||||||
|
AWS_TOKEN: ${{ secrets.AWS_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### Debug logging
|
### Debug logging
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,11 @@ inputs:
|
||||||
Use a lightweight renovate container without any third-party binaries.
|
Use a lightweight renovate container without any third-party binaries.
|
||||||
Defaults to true if not set.
|
Defaults to true if not set.
|
||||||
required: false
|
required: false
|
||||||
|
env-regex:
|
||||||
|
description: |
|
||||||
|
Override the environment variables which will be passsed into the renovate container.
|
||||||
|
Defaults to `^(?:RENOVATE_\\w+|LOG_LEVEL|GITHUB_COM_TOKEN|NODE_OPTIONS)$`
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: node16
|
using: node16
|
||||||
main: dist/index.js
|
main: dist/index.js
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,11 @@ class Input {
|
||||||
private readonly _configurationFile: Readonly<EnvironmentVariable>;
|
private readonly _configurationFile: Readonly<EnvironmentVariable>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
const envRegexInput = core.getInput('env-regex');
|
||||||
|
const envRegex = envRegexInput ? new RegExp(envRegexInput) : this.options.envRegex;
|
||||||
this._environmentVariables = new Map(
|
this._environmentVariables = new Map(
|
||||||
Object.entries(process.env).filter(([key]) =>
|
Object.entries(process.env).filter(([key]) =>
|
||||||
this.options.envRegex.test(key)
|
envRegex.test(key)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue