feat: add token input and account for Renovate WORKDIR

This commit is contained in:
Jeroen de Bruijn 2020-03-19 23:00:43 +01:00
parent 341841ebc6
commit cd4dee3297
No known key found for this signature in database
GPG key ID: 7D12D6AB2A547EBB
3 changed files with 23 additions and 7 deletions

View file

@ -1,11 +1,11 @@
name: Basic example name: Example
on: on:
push: push:
branches: branches:
- master - master
pull_request: pull_request:
jobs: jobs:
basic-example: example:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -14,3 +14,4 @@ jobs:
uses: ./ uses: ./
with: with:
configurationFile: 'test/config.js' configurationFile: 'test/config.js'
token: ${{ secrets.RENOVATE_TOKEN }}

View file

@ -6,6 +6,14 @@ inputs:
description: 'Renovate configuration file' description: 'Renovate configuration file'
required: false required: false
default: 'src/config.js' default: 'src/config.js'
token:
description: |
Personal access token that Renovate should use. This should be configured
using a GitHub secret.
required: true
runs: runs:
using: 'docker' using: 'docker'
image: 'src/Dockerfile' image: 'src/Dockerfile'
args:
- ${{ inputs.configurationFile }}
- ${{ inputs.token }}

View file

@ -3,6 +3,8 @@
# Entrypoint for Docker. # Entrypoint for Docker.
readonly CONFIGURATION_FILE="${1}" readonly CONFIGURATION_FILE="${1}"
readonly TOKEN="${2}"
readonly CONFIGURATION_PATH="${GITHUB_WORKSPACE}/${CONFIGURATION_FILE}" readonly CONFIGURATION_PATH="${GITHUB_WORKSPACE}/${CONFIGURATION_FILE}"
if [[ ! -f "${CONFIGURATION_PATH}" ]]; then if [[ ! -f "${CONFIGURATION_PATH}" ]]; then
@ -10,12 +12,17 @@ if [[ ! -f "${CONFIGURATION_PATH}" ]]; then
exit 1 exit 1
fi fi
cp "${CONFIGURATION_PATH}" '/usr/src/app/config.js' readonly WORKDIR='/usr/src/app'
# Account for the WORKDIR entry of the renovate/renovate Docker container. See
# the followling link for this entry.
# https://github.com/renovatebot/renovate/blob/19.175.3/Dockerfile#L14
cd "${WORKDIR}" || { echo "ERROR: Couldn't cd to ${WORKDIR}" 1>&2; exit 1; }
cp "${CONFIGURATION_PATH}" './config.js'
# Run Renovate. # Run Renovate.
# #
# This mimics the original entrypoint of the renovate/renovate Docker container. # Mimic the original ENTRYPOINT of the renovate/renovate Docker container. See
# See the following link for this entrypoint in the renovate/renovate Docker # the following link for this entry.
# container.
# https://github.com/renovatebot/renovate/blob/19.175.3/Dockerfile#L220 # https://github.com/renovatebot/renovate/blob/19.175.3/Dockerfile#L220
node /usr/src/app/dist/renovate.js RENOVATE_TOKEN="${TOKEN}" node /usr/src/app/dist/renovate.js