diff --git a/README.md b/README.md index c18cfd17..1fd583b0 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,45 @@ jobs: token: ${{ secrets.RENOVATE_TOKEN }} ``` +## `renovate-image` + +The Renovate docker image name to use. +If omited or `renovate-image === ''` the action will use the `renovate/renovate` docker image name otherwise. +If a docker image name is defined, the action will use that name to pull the image. + +This sample will use `myproxyhub.domain.com/renovate/renovate:slim` image. + +```yml +.... +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Self-hosted Renovate + uses: renovatebot/github-action@v36.0.0 + with: + renovate-image: myproxyhub.domain.com/renovate/renovate + token: ${{ secrets.RENOVATE_TOKEN }} +``` + +This sample will use `renovate/renovate:slim` image. + +```yml +.... +jobs: + renovate: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3.3.0 + - name: Self-hosted Renovate + uses: renovatebot/github-action@v36.0.0 + with: + token: ${{ secrets.RENOVATE_TOKEN }} +``` + ## `useSlim` If set to `false` the action will use the full renovate image instead of the slim image. diff --git a/action.yml b/action.yml index d08318a2..f5e51824 100644 --- a/action.yml +++ b/action.yml @@ -30,6 +30,11 @@ inputs: description: | Renovate version to use. Defaults to latest. required: false + renovate-image: + description: | + Renovate docker image name. + Defaults to `renovate/renovate`. + required: false runs: using: node16 main: dist/index.js diff --git a/src/docker.ts b/src/docker.ts index 925085bc..5cfb049c 100644 --- a/src/docker.ts +++ b/src/docker.ts @@ -2,10 +2,14 @@ import type { Input } from './input'; class Docker { private static readonly repository = 'renovate/renovate'; + + private readonly dockerImage: string; private readonly fullTag: string; constructor(input: Input) { const tag = input.getVersion(); + + this.dockerImage = input.getDockerImage() ?? Docker.repository; this.fullTag = input.useSlim() ? tag ? `${tag}-slim` @@ -14,7 +18,7 @@ class Docker { } image(): string { - return `${Docker.repository}:${this.fullTag}`; + return `${this.dockerImage}:${this.fullTag}`; } } diff --git a/src/input.ts b/src/input.ts index f9a67a61..228bcb90 100644 --- a/src/input.ts +++ b/src/input.ts @@ -64,6 +64,10 @@ class Input { return core.getInput('useSlim') !== 'false'; } + getDockerImage(): string | null { + return core.getInput('renovate-image') || null; + } + getVersion(): string | null { const version = core.getInput('renovate-version'); return !!version && version !== '' ? version : null;