### Basic Renovate Action with PAT Source: https://github.com/renovatebot/github-action/blob/main/README.md This example demonstrates a basic setup for the Renovate GitHub Action using a Personal Access Token (PAT). The action runs on a schedule and checks out the repository before executing Renovate. ```yaml name: Renovate on: schedule: # The "*" (#42, asterisk) character has special semantics in YAML, so this # string has to be quoted. - cron: '0/15 * * * *' jobs: renovate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6.0.3 - name: Self-hosted Renovate uses: renovatebot/github-action@v46.1.15 with: configurationFile: example/renovate-config.js token: ${{ secrets.RENOVATE_TOKEN }} ``` -------------------------------- ### Custom Entrypoint Script for Renovate Setup Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/08-workflow-examples.md Define a shell script to install system packages and set up the environment before Renovate runs. This script is executed by the Renovate Docker image. ```bash #!/bin/bash set -e # Install additional system packages apt-get update apt-get install -y \ build-essential \ libpq-dev \ git-lfs # Run Renovate as unprivileged user runuser -u ubuntu renovate ``` -------------------------------- ### Renovate JSON5 Configuration Example Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/06-configuration.md An example of Renovate configuration using JSON5, demonstrating support for comments and trailing commas. ```json5 { // Comment branchPrefix: "renovate/", repositories: [ "owner/repo1", "owner/repo2", // trailing comma allowed ], } ``` -------------------------------- ### Custom Renovate Initialization Script Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/12-advanced-usage.md Execute pre-flight setup steps, such as installing dependencies and configuring Git, before Renovate starts. This script is executed within a Docker container. ```bash #!/bin/bash set -e echo "Installing dependencies..." apt-get update apt-get install -y build-essential python3-dev echo "Configuring Git..." git config --global user.email "renovate-bot@example.com" git config --global user.name "Renovate Bot" echo "Setting up credentials..." # Create .netrc for authentication cat > ~/.netrc <', onboarding: false, requireConfig: 'optional', platform: 'github', repositories: ['owner/repo1', 'owner/repo2'], }; ``` -------------------------------- ### Renovate Configuration Error Example Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md Illustrates a Renovate configuration error that can cause 'Docker Run Command Failed'. Ensure the 'repositories' field is an array. ```javascript // In renovate-config.js - invalid config module.exports = { repositories: 'invalid', // Should be array }; ``` -------------------------------- ### Access Service from Renovate Configuration Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/12-advanced-usage.md Configure Renovate to interact with services available on the Docker network. This example shows how to run a PostgreSQL command to verify connectivity. ```javascript module.exports = { postUpgradeTasks: commands: [ 'psql -h postgres -U postgres -d template1 -c "SELECT 1"', ], }; ``` -------------------------------- ### Example Custom Regex Patterns Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/10-action-inputs.md Illustrative JavaScript regex patterns for filtering environment variables. These examples demonstrate how to include specific tokens, custom prefixes, or only Renovate variables. ```javascript // Add AWS access ^(?:RENOVATE_\w+|LOG_LEVEL|AWS_TOKEN|AWS_SECRET_ACCESS_KEY)$ ``` ```javascript // Add NPM and PyPI tokens ^(?:RENOVATE_\w+|LOG_LEVEL|NPM_TOKEN|PIP_PASSWORD)$ ``` ```javascript // Allow all CUSTOM_ prefixed vars ^(?:RENOVATE_\w+|LOG_LEVEL|CUSTOM_\w+)$ ``` ```javascript // Conservative: only RENOVATE_ ^RENOVATE_\w+$ ``` -------------------------------- ### Check Docker Availability Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/11-docker-integration.md Verify that the Docker client is installed and that the Docker daemon is running by checking the version and listing running containers. ```bash docker --version docker ps ``` -------------------------------- ### Example: Correct Docker Socket Path Usage Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md This snippet shows how to correctly specify the Docker socket path when 'mount-docker-socket' is enabled in the Renovate GitHub Action. ```yaml # Use correct socket path - uses: renovatebot/github-action@v46 with: mount-docker-socket: true docker-socket-host-path: /var/run/docker.sock token: ${{ secrets.RENOVATE_TOKEN }} ``` -------------------------------- ### Example: Verifying Docker Socket and Daemon Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md These shell commands help diagnose issues with the Docker socket by verifying its existence and checking if the Docker daemon is running. ```bash # Verify Docker socket exists ls -la /var/run/docker.sock # Verify Docker is running docker ps ``` -------------------------------- ### Configure Renovate with Custom Image Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md Example of configuring the Renovate action with a custom Docker image. This scenario might lead to a 'Docker Run Command Failed' error if the image is not found. ```yaml - uses: renovatebot/github-action@v46 with: renovate-image: nonexistent.registry.com/renovate renovate-version: latest token: ${{ secrets.RENOVATE_TOKEN }} # ERROR: docker run failed - image not found ``` -------------------------------- ### Example: Missing Required Token Input Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md This snippet shows a GitHub Actions workflow where the 'token' input is omitted, which is a required input for the Renovate Action. ```yaml # Missing token input and env var - uses: renovatebot/github-action@v46 with: configurationFile: renovate-config.js # token is missing - ERROR ``` -------------------------------- ### Example GitHub Actions Workflow Output Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/04-entry-point.md Illustrates a typical output in GitHub Actions logs, including a grouped version check, a notice message for the Renovate CLI version, and placeholder for container execution output. ```bash ##[group]Check Renovate version + docker run -t --rm ghcr.io/renovatebot/renovate:43 --version renovate 43.233.3 ##[notice title=Renovate CLI version]renovate 43.233.3 ##[endgroup] Docker socket will be mounted inside the renovate container... (Renovate container execution output) Renovate execution completed successfully ``` -------------------------------- ### Example: Fixing Missing Required Token Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md This snippet demonstrates how to correctly provide the 'token' input using a GitHub secret to resolve the missing token error. ```yaml - uses: renovatebot/github-action@v46 with: configurationFile: renovate-config.js token: ${{ secrets.RENOVATE_TOKEN }} ``` -------------------------------- ### Build Custom Renovate Docker Image Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/12-advanced-usage.md Use this Dockerfile to build a custom Renovate image with additional tools and configurations. Install custom build tools and linters, then set custom environment variables and copy configuration files. ```dockerfile FROM ghcr.io/renovatebot/renovate:43 # Install custom tools RUN apt-get update && apt-get install -y \ custom-build-tool \ custom-linter # Set custom defaults ENV CUSTOM_TOOL_CONFIG=/etc/custom-tool/config.yaml COPY custom-config.yaml /etc/custom-tool/config.yaml ``` -------------------------------- ### Renovate Action for GitHub Enterprise Source: https://github.com/renovatebot/github-action/blob/main/README.md This example shows how to configure the Renovate GitHub Action for use with GitHub Enterprise. It includes an additional environment variable to specify the Renovate endpoint for your enterprise instance. ```yaml .... - name: Self-hosted Renovate uses: renovatebot/github-action@v46.1.15 with: configurationFile: example/renovate-config.js token: ${{ secrets.RENOVATE_TOKEN }} env: RENOVATE_ENDPOINT: "https://git.your-company.com/api/v3" ``` -------------------------------- ### Renovate GitHub Enterprise Setup Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/08-workflow-examples.md Configure the Renovate GitHub Action to connect to a GitHub Enterprise instance using a personal access token. Ensure the RENOVATE_ENDPOINT environment variable is set to your enterprise API URL. ```yaml name: Renovate Enterprise on: schedule: - cron: '0 3 * * *' jobs: renovate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: renovatebot/github-action@v46 with: configurationFile: renovate-config.js token: ${{ secrets.RENOVATE_TOKEN }} env: RENOVATE_ENDPOINT: https://git.company.com/api/v3 ``` ```javascript module.exports = { branchPrefix: 'renovate/', repositories: 'team/private-repo-1', 'team/private-repo-2', }; ``` -------------------------------- ### Example: Token Contains Whitespace Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md These examples illustrate how leading/trailing or embedded whitespace in the token input can cause errors. The multiline YAML example shows a token with an embedded newline. ```yaml # Token with leading/trailing space token: ' ${{ secrets.RENOVATE_TOKEN }}' # Token with embedded newline (YAML multiline) token: | ghp_xxxxx ``` -------------------------------- ### GitHub Actions Workflow with Repository Cache Source: https://github.com/renovatebot/github-action/blob/main/README.md This workflow example demonstrates how to enable, persist, and restore the Renovate repository cache using GitHub Actions artifacts. It includes steps for setting up the cache directory and restoring it before Renovate execution. ```yaml name: Renovate on: schedule: - cron: "30 0 * * *" jobs: renovate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 - name: Setup Node.js uses: actions/setup-node@v3 with: node-version: 18 - name: Install Renovate run: npm install -g renovate - name: Restore cache artifact uses: actions/download-artifact@v3 with: name: renovate-cache path: /tmp/renovate/cache - name: Run Renovate env: GITHUB_TOKEN: ${{ secrets.RENOVATE_TOKEN }} run: | renovate --config-file renovate.json --platform github chown -R root:root /tmp/renovate/cache - name: Archive and upload cache artifact uses: actions/upload-artifact@v3 with: name: renovate-cache path: /tmp/renovate/cache retention-days: 1 ``` -------------------------------- ### Renovate GitHub Action Docker Execution Data Flow Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/09-architecture.md Outlines the data flow for Docker execution, starting from input and configuration, through command building, to execution and result retrieval. ```text Input + Renovate config ↓ Build Docker command ├─ Environment variables ├─ Volume mounts ├─ Network settings ├─ User/group └─ Image with tag ↓ Execute via docker run ↓ Return exit code ``` -------------------------------- ### Renovate Action with Commit Signing (GitHub App) Source: https://github.com/renovatebot/github-action/blob/main/README.md This example shows how to enable commit signing when using the Renovate GitHub Action with a GitHub App. It sets the `RENOVATE_PLATFORM_COMMIT` environment variable to 'enabled'. ```yaml - name: Self-hosted Renovate uses: renovatebot/github-action@v46.1.15 with: token: '${{ steps.get_token.outputs.token }}' env: RENOVATE_PLATFORM_COMMIT: 'enabled' ``` -------------------------------- ### Renovate JavaScript Configuration File Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/08-workflow-examples.md An advanced configuration for Renovate using a JavaScript file. This example sets up specific rules for package updates, including auto-merging patch updates and scheduling lock file maintenance. This file should be placed at `.github/renovate-config.js`. ```javascript module.exports = { // Self-hosted specific settings branchPrefix: 'renovate/', username: 'renovate-bot', gitAuthor: 'Renovate Bot ', platform: 'github', // General behavior onboarding: false, requireConfig: 'optional', dryRun: false, // Target repositories repositories: [ 'myorg/repo1', 'myorg/repo2', 'myorg/repo3', ], // Package rules packageRules: [ { description: 'Lock file maintenance', matchUpdateTypes: ['lockFileMaintenance'], schedule: ['before 3am on Monday'], }, { description: 'Auto-merge patch updates', matchUpdateTypes: ['patch'], autoMerge: true, automergeType: 'pr', automergeStrategy: 'squash', }, ], }; ``` -------------------------------- ### Renovate Action Error Message Example Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md Example of an error message displayed in the GitHub Actions UI, indicating a problem with the provided token not containing whitespace. ```text ##[error]Error: Token MUST NOT contain whitespace ##[error]Error details: at Input.get (src/input.ts:122) at new Input (src/input.ts:40) at run (src/index.ts:7) at process.onPrefixedMessage... ``` -------------------------------- ### Uncaught Error Example Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md This example shows an error being created but not thrown within the code. Such errors are logged to the console directly but do not propagate to the main catch block, nor do they stop execution or mark the action as failed. This behavior might be a bug. ```typescript // src/renovate.ts:22 const { exitCode, stdout } = await getExecOutput(command); if (exitCode !== 0) { new Error(`'docker run' failed with exit code ${exitCode}.`); // ERROR CREATED BUT NOT THROWN - only logged } ``` -------------------------------- ### Production Build Command Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/README.md Use this command to create a production-ready release build of the action. ```bash npm run release ``` -------------------------------- ### Docker Constructor Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/03-docker.md Initializes Docker configuration from Input, using defaults and logging warnings if not specified. ```APIDOC ## Constructor Docker ### Description Initializes Docker configuration from Input, using defaults and logging warnings if not specified. ### Parameters #### Path Parameters - `input` (Input) - Required - Processed action inputs ### Example ```typescript import { Input } from './input'; import { Docker } from './docker'; const input = new Input(); const docker = new Docker(input); // If inputs not provided, logs warnings about using defaults ``` ``` -------------------------------- ### Get Renovate Version Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/01-input.md Retrieves the Renovate version from the 'renovate-version' input. Defaults to version '43' if not specified. ```typescript getVersion(): string | null ``` ```typescript const version = input.getVersion(); // Returns: '43.233.3', 'full', or null ``` -------------------------------- ### Use Custom Docker Entrypoint Script Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/06-configuration.md Specify a path to an executable script to be used as the Docker container's entrypoint. This script will be mounted into the container and executed as the entrypoint, allowing for custom initialization before Renovate runs. ```bash #!/bin/bash apt update apt install -y build-essential libpq-dev runuser -u ubuntu renovate ``` ```yaml with: docker-cmd-file: .github/renovate-entrypoint.sh docker-user: root ``` -------------------------------- ### Get Docker Image Name Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/01-input.md Retrieves the Docker image name from the 'renovate-image' input. Defaults to 'ghcr.io/renovatebot/renovate' if not specified. ```typescript getDockerImage(): string | null ``` ```typescript const image = input.getDockerImage(); // Returns: 'ghcr.io/renovatebot/renovate' or custom image name or null ``` -------------------------------- ### Docker Configuration from Input Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/10-action-inputs.md Illustrates how inputs are used to configure Docker image, volume mounts, user, and network for the Renovate action. ```typescript // Image construction docker.image() // Uses getDockerImage() + getVersion() // Returns: "${image}:${version}" // Volume mounts getDockerVolumeMounts() // Used in: --volume mount1 --volume mount2 // Docker user getDockerUser() // Used in: --user username // Docker network getDockerNetwork() // Used in: --network network-name ``` -------------------------------- ### Example: Fixing Token Whitespace Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md This snippet shows the correct way to specify the token input, ensuring no whitespace is included. ```yaml # Ensure token has no whitespace token: ${{ secrets.RENOVATE_TOKEN }} ``` -------------------------------- ### File Mounts from Input Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/10-action-inputs.md Explains how configuration files and Docker command scripts are mounted into the container using volume mounts and corresponding environment variables. ```typescript // Configuration file mounting configurationFile() // Host path: resolved to absolute path // Container path: /github-action/ // Mount: --volume /abs/path:/github-action/renovate-config.js // Env var: --env RENOVATE_CONFIG_FILE=/github-action/renovate-config.js // Docker command file mounting getDockerCmdFile() // Host path: resolved to absolute path // Container path: / // Mount: --volume /abs/path:/renovate-entrypoint.sh // Appended: /renovate-entrypoint.sh ``` -------------------------------- ### Get Renovate CLI Version Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/02-renovate.md Executes a Docker container to retrieve the Renovate CLI version. Errors are logged but not thrown. ```typescript const version = await renovate.runDockerContainerForVersion(); // Returns: 'renovate 43.233.3' or similar ``` -------------------------------- ### Main Execution Command with Docker Arguments Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/11-docker-integration.md Illustrates the structure of the main Docker execution command for Renovate, including placeholders for various arguments. ```bash docker run -t \ --env VAR1=value1 \ --env VAR2=value2 \ --volume /host:/container \ --user username \ --group-add groupid \ --network network-name \ --rm \ image:tag \ [optional-command] ``` -------------------------------- ### Get Docker Socket Host Path Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/01-input.md Retrieves the host path for the Docker socket. Defaults to '/var/run/docker.sock'. Only applicable when 'mountDockerSocket()' returns true. ```typescript dockerSocketHostPath(): string ``` ```typescript const socketPath = input.dockerSocketHostPath(); // Returns: '/var/run/docker.sock' or custom path ``` -------------------------------- ### Renovate Docker Arguments Order Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/02-renovate.md Illustrates the expected order of arguments for constructing the `docker run` command when executing Renovate. ```bash docker run -t \ --env \ --env \ ... \ --env RENOVATE_TOKEN= \ [--env RENOVATE_CONFIG_FILE=] \ [--volume :] \ [--volume :/var/run/docker.sock] \ [--group-add ] \ [--volume :] \ [--user ] \ [--volume --volume ...] \ [--network ] \ --rm \ [] ``` -------------------------------- ### Validate Action Arguments Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/02-renovate.md Validates action inputs such as the token and configuration file before Docker execution. This method is automatically called at the start of runDockerContainer(). ```typescript private async validateArguments(): Promise ``` ```typescript await renovate.validateArguments(); // Throws if token has spaces or config file doesn't exist ``` -------------------------------- ### Whitelist Environment Variables with env-regex Source: https://github.com/renovatebot/github-action/blob/main/README.md Whitelist additional environment variables to be passed to the Docker container by overriding the default env-regex. This example whitelists AWS_TOKEN. ```yaml .... jobs: renovate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6.0.3 - name: Self-hosted Renovate uses: renovatebot/github-action@v46.1.15 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 }} ``` -------------------------------- ### Dynamic Configuration from Environment Variables Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/12-advanced-usage.md Configure Renovate using a JavaScript file that reads values from environment variables. This allows for dynamic settings based on the CI/CD environment. ```javascript module.exports = { branchPrefix: process.env.RENOVATE_BRANCH_PREFIX || 'renovate/', hostRules: [ { hostType: 'npm', matchHost: 'registry.npmjs.org', token: process.env.NPM_TOKEN, timeout: 60000, }, { hostType: 'pypi', matchHost: 'pypi.org', username: 'pypi_user', password: process.env.PIP_PASSWORD, }, { hostType: 'rubygems', matchHost: 'rubygems.org', token: process.env.RUBYGEMS_TOKEN, }, ], postUpgradeTasks: { commands: [ `docker build --build-arg PLATFORM=${process.env.CUSTOM_BUILD_PLATFORM} .`, ], }, }; ``` -------------------------------- ### Get Docker Network Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/01-input.md Retrieves the Docker network name from the 'docker-network' input. Defaults to an empty string, indicating the use of the default Docker network. ```typescript getDockerNetwork(): string ``` ```typescript const network = input.getDockerNetwork(); // Returns: 'host', 'bridge', custom network name, or empty string ``` -------------------------------- ### Get Docker User Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/01-input.md Retrieves the Docker user or user-id from the 'docker-user' input. Defaults to null, meaning the container runs as the default unprivileged user. ```typescript getDockerUser(): string | null ``` ```typescript const user = input.getDockerUser(); // Returns: 'root', 'ubuntu', '1000', or null ``` -------------------------------- ### Get Configuration File Path Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/01-input.md Retrieves the resolved configuration file path. Returns null if no configuration is provided. The path is resolved to an absolute path. ```typescript configurationFile(): EnvironmentVariable | null ``` ```typescript const config = input.configurationFile(); if (config) { console.log(config.key); // 'RENOVATE_CONFIG_FILE' console.log(config.value); // '/absolute/path/to/config.js' } ``` -------------------------------- ### Compile Entry Point with esbuild Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/04-entry-point.md This snippet shows the esbuild configuration used to compile the action's entry point. It bundles dependencies, targets Node.js 24, and includes a CommonJS shim for compatibility. ```javascript // tools/compile.js esbuild.build({ entryPoints: ['./src/index.ts'], bundle: true, platform: 'node', target: 'node24', format: 'esm', outdir: './dist/', inject: ['tools/cjs-shim.ts'], // ... }) ``` -------------------------------- ### Configure Renovate for Multiple Repositories Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/12-advanced-usage.md Define multiple repositories in a single configuration file for centralized management. This approach simplifies token usage, shares rate limits, and centralizes configuration. ```javascript module.exports = { branchPrefix: 'renovate/', baseBranches: ['main', 'develop'], repositories: [ 'myorg/frontend', 'myorg/backend', 'myorg/mobile', 'myorg/infrastructure', ], }; ``` -------------------------------- ### Mount Renovate Configuration File Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/11-docker-integration.md Mounts a local Renovate configuration file into the container and sets an environment variable to point to it. Ensure the host path is absolute. ```bash --volume /absolute/path/to/renovate-config.js:/github-action/renovate-config.js --env RENOVATE_CONFIG_FILE=/github-action/renovate-config.js ``` -------------------------------- ### Bash: Docker Run Command Options Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/11-docker-integration.md Demonstrates essential options for running a Docker container, including auto-removal and TTY allocation. ```bash docker run --rm # Auto-remove container after exit -t # Allocate TTY (for interactive output) [arguments] # All config from Input class ``` -------------------------------- ### Set Renovate Configuration File via Action Input Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/06-configuration.md Provide the `configurationFile` input parameter to specify the path to a JavaScript or JSON configuration file for Renovate. ```yaml with: configurationFile: example/renovate-config.js ``` -------------------------------- ### Invoke Main Execution Function Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/04-entry-point.md Immediately invokes the main run() function when the action starts. Errors are caught internally to prevent unhandled promise rejections. ```typescript void run(); ``` -------------------------------- ### Configure Renovate Onboarding and Configuration Requirement Source: https://github.com/renovatebot/github-action/blob/main/README.md Use these lines in your configuration file to disable the requirement for a repository configuration file and disable onboarding. ```javascript onboarding: false, requireConfig: 'optional', ``` -------------------------------- ### Custom env-regex: Add custom variable Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/06-configuration.md Example of a custom regex pattern to include a specific custom variable, MY_CUSTOM_VAR, in the environment variables passed to the Renovate container. ```regex # Add custom variable ^(?:RENOVATE_\w+|LOG_LEVEL|MY_CUSTOM_VAR)$ ``` -------------------------------- ### Pass Renovate Token and Configuration via Environment Variables Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/11-docker-integration.md Demonstrates how to pass the Renovate token and configuration file path to the Docker container using `--env` flags. The token is securely passed using its key and value. ```bash --env RENOVATE_TOKEN=${token} --env RENOVATE_CONFIG_FILE=/github-action/renovate-config.js # if provided ``` ```typescript dockerArguments.push( `--env ${this.input.token.key}=${this.input.token.value}` ); ``` -------------------------------- ### Check Self-Hosted Runner Environment for Docker Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/07-errors.md Verify that Docker is installed, running, and accessible via its socket on self-hosted runners. Also checks for the existence of the 'docker' group. ```bash # Docker installed docker --version # Docker running docker ps # Docker socket accessible ls -la /var/run/docker.sock # Docker group exists grep docker /etc/group ``` -------------------------------- ### Core Action Functions Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/05-types.md Lists the primary functions provided by `@actions/core` and `@actions/exec` for interacting with the GitHub Actions environment, such as getting inputs, managing output, and executing commands. ```typescript // No explicit exports - entry point only defines run() function ``` -------------------------------- ### Basic Self-Hosted Renovate Workflow Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/08-workflow-examples.md A minimal workflow to run Renovate on a schedule. It checks out the repository and executes Renovate using default settings. Requires a Renovate token with 'repo' scope. ```yaml name: Renovate on: schedule: - cron: '0 */4 * * *' # Every 4 hours jobs: renovate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Self-hosted Renovate uses: renovatebot/github-action@v46 with: configurationFile: renovate-config.js token: ${{ secrets.RENOVATE_TOKEN }} ``` -------------------------------- ### Renovate Configuration with Environment Variables Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/08-workflow-examples.md Define host rules in a Renovate configuration file to use environment variables for tokens. This allows dynamic credential management for different registries. ```javascript module.exports = { hostRules: [ { hostType: 'npm', matchHost: 'registry.npmjs.org', token: process.env.NPM_TOKEN, }, { hostType: 'pypi', matchHost: 'pypi.org', password: process.env.PIP_PASSWORD, }, ], }; ``` -------------------------------- ### Get Docker Group ID Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/02-renovate.md Extracts the Docker group ID from the /etc/group file on GitHub Actions runners. This method is automatically called by runDockerContainer() when mountDockerSocket() is true. ```typescript private async getDockerGroupId(): Promise ``` ```typescript const groupId = await renovate.getDockerGroupId(); // Returns: '999' (typical docker group ID) ``` -------------------------------- ### Workflow Configuration for Dynamic Settings Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/12-advanced-usage.md Set up a GitHub Actions workflow to use a dynamic Renovate configuration file and pass necessary environment variables. Ensure the 'env-regex' includes all custom environment variables used in the configuration. ```yaml with: configurationFile: renovate-config.js token: ${{ secrets.RENOVATE_TOKEN }} env-regex: '^(?:RENOVATE_\w+|LOG_LEVEL|NPM_TOKEN|PIP_PASSWORD|RUBYGEMS_TOKEN|CUSTOM_BUILD_PLATFORM)$' env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} PIP_PASSWORD: ${{ secrets.PIP_PASSWORD }} RUBYGEMS_TOKEN: ${{ secrets.RUBYGEMS_TOKEN }} CUSTOM_BUILD_PLATFORM: linux/amd64 RENOVATE_BRANCH_PREFIX: deps/ ``` -------------------------------- ### Pass Credentials via Environment Variable Source: https://github.com/renovatebot/github-action/blob/main/README.md Pass credentials to the Docker container by prefixing the environment variable with RENOVATE_. This example shows how to pass a TFE token for host rules. ```yaml .... jobs: renovate: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v6.0.3 - name: Self-hosted Renovate uses: renovatebot/github-action@v46.1.15 with: configurationFile: example/renovate-config.js token: ${{ secrets.RENOVATE_TOKEN }} env: RENOVATE_TFE_TOKEN: ${{ secrets.MY_TFE_TOKEN }} ``` -------------------------------- ### Custom env-regex: Add AWS_TOKEN support Source: https://github.com/renovatebot/github-action/blob/main/_autodocs/06-configuration.md Example of a custom regex pattern to include AWS_TOKEN in the environment variables passed to the Renovate container, in addition to the default safe variables. ```regex # Add AWS_TOKEN support ^(?:RENOVATE_\w+|LOG_LEVEL|GITHUB_COM_TOKEN|NODE_OPTIONS|NO_COLOR|(?:HTTPS?|NO)_PROXY|(?:https?|no)_proxy|AWS_TOKEN)$ ```