diff --git a/.eslintrc.js b/.eslintrc.js index 23d2b377..de417398 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,6 @@ module.exports = { 'eslint:recommended', 'plugin:@typescript-eslint/eslint-recommended', 'plugin:@typescript-eslint/recommended', - 'prettier/@typescript-eslint', 'plugin:prettier/recommended', ], parser: '@typescript-eslint/parser', diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc056529..32357485 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: with: fetch-depth: 0 - name: Lint commit messages - uses: wagoid/commitlint-github-action@v2.2.5 + uses: wagoid/commitlint-github-action@v3.0.6 lint: runs-on: ubuntu-latest @@ -48,6 +48,8 @@ jobs: run: npm run build - name: Renovate test uses: ./ + env: + LOG_LEVEL: debug with: configurationFile: ${{ matrix.configurationFile }} token: ${{ secrets.RENOVATE_TOKEN }} diff --git a/README.md b/README.md index 57b02b03..528c5db8 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ GitHub Action to run Renovate self-hosted. ## Options +Options can be passed using the inputs of this action or the corresponding environment variables. When both are passed, the input takes precedence over the environment variable. For the available environment variables see the Renovate [Self-Hosted Configuration](https://docs.renovatebot.com/self-hosted-configuration/) and [Self-Hosting](https://docs.renovatebot.com/self-hosting/) docs. + ## `configurationFile` Configuration file to configure Renovate. The supported configurations files can be one of the configuration files listed in the Renovate Docs for [Configuration Options](https://docs.renovatebot.com/configuration-options/) or a JavaScript file that exports a configuration object. For both of these options, an example can be found in the [example](./example) directory. @@ -80,11 +82,11 @@ jobs: Instead of using a Personal Access Token (PAT) that is tied to a particular user you can use a [GitHub App](https://docs.github.com/en/developers/apps/building-github-apps) where permissions can be even better tuned. [Create a new app](https://docs.github.com/en/developers/apps/creating-a-github-app) and give it the following permissions: -| Permission | Level | -|-----------------|---------------------| -| `Contents` | `Read & write` | -| `Metadata` | `Read-only` | -| `Pull requests` | `Read & write` | +| Permission | Level | +| --------------- | -------------- | +| `Contents` | `Read & write` | +| `Metadata` | `Read-only` | +| `Pull requests` | `Read & write` | Store the app ID as a secret with name `APP_ID` and generate a new private key for the app and add it as a secret to the repository as `APP_PEM` in the repository where the action will run from. Note that `APP_PEM` needs to be base64 encoded. You can encode your private key file like this from the terminal: @@ -121,5 +123,5 @@ jobs: uses: renovatebot/github-action@v21.30.0 with: configurationFile: example/renovate-config.js - token: "x-access-token:${{ steps.get_token.outputs.app_token }}" + token: 'x-access-token:${{ steps.get_token.outputs.app_token }}' ``` diff --git a/action.yml b/action.yml index f48c435d..749d2362 100644 --- a/action.yml +++ b/action.yml @@ -6,14 +6,16 @@ branding: color: blue inputs: configurationFile: - description: 'Configuration file to configure Renovate' + description: | + Configuration file to configure Renovate. Either use this input or the + 'RENOVATE_CONFIG_FILE' environment variable. required: false - default: src/config.js token: description: | GitHub personal access token that Renovate should use. This should be - configured using a Secret. - required: true + configured using a Secret. Either use this input or the 'RENOVATE_TOKEN' + environment variable. + required: false runs: using: node12 main: dist/index.js diff --git a/example/renovate-config.js b/example/renovate-config.js index 202b8c60..c38fdf8a 100644 --- a/example/renovate-config.js +++ b/example/renovate-config.js @@ -2,7 +2,6 @@ module.exports = { branchPrefix: 'test-renovate/', dryRun: true, gitAuthor: 'Renovate Bot ', - logLevel: 'debug', onboarding: false, platform: 'github', includeForks: true, diff --git a/example/renovate.json b/example/renovate.json index dd8a5ab4..b04579ed 100644 --- a/example/renovate.json +++ b/example/renovate.json @@ -2,7 +2,6 @@ "branchPrefix": "test-renovate/", "dryRun": true, "gitAuthor": "Renovate Bot ", - "logLevel": "debug", "onboarding": false, "platform": "github", "includeForks": true, diff --git a/package-lock.json b/package-lock.json index 00d9d71e..ee340807 100644 --- a/package-lock.json +++ b/package-lock.json @@ -100,138 +100,140 @@ } } }, - "@babel/runtime": { - "version": "7.13.8", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.13.8.tgz", - "integrity": "sha512-CwQljpw6qSayc0fRG1soxHAKs1CnQMOChm4mlQP6My0kf9upVGizj/KhlTTgyUnETmHpcUXjaluNAkteRFuafg==", - "dev": true, - "requires": { - "regenerator-runtime": "^0.13.4" - } - }, "@commitlint/cli": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-11.0.0.tgz", - "integrity": "sha512-YWZWg1DuqqO5Zjh7vUOeSX76vm0FFyz4y0cpGMFhrhvUi5unc4IVfCXZ6337R9zxuBtmveiRuuhQqnRRer+13g==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/cli/-/cli-12.0.1.tgz", + "integrity": "sha512-V+cMYNHJOr40XT9Kvz3Vrz1Eh7QE1rjQrUbifawDAqcOrBJFuoXwU2SAcRtYFCSqFy9EhbreQGhZFs8dYb90KA==", "dev": true, "requires": { - "@babel/runtime": "^7.11.2", - "@commitlint/format": "^11.0.0", - "@commitlint/lint": "^11.0.0", - "@commitlint/load": "^11.0.0", - "@commitlint/read": "^11.0.0", - "chalk": "4.1.0", - "core-js": "^3.6.1", + "@commitlint/format": "^12.0.1", + "@commitlint/lint": "^12.0.1", + "@commitlint/load": "^12.0.1", + "@commitlint/read": "^12.0.1", + "@commitlint/types": "^12.0.1", "get-stdin": "8.0.0", "lodash": "^4.17.19", "resolve-from": "5.0.0", "resolve-global": "1.0.0", - "yargs": "^15.1.0" + "yargs": "^16.2.0" } }, "@commitlint/config-conventional": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-11.0.0.tgz", - "integrity": "sha512-SNDRsb5gLuDd2PL83yCOQX6pE7gevC79UPFx+GLbLfw6jGnnbO9/tlL76MLD8MOViqGbo7ZicjChO9Gn+7tHhA==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/config-conventional/-/config-conventional-12.0.1.tgz", + "integrity": "sha512-1ZhB135lh47zVmf1orwcjxuKuam11fJIH/bdVxW9XiQv8XPwC6iIp19knfl8FcOT78AVBnes1z6EVxgUeP2/4Q==", "dev": true, "requires": { "conventional-changelog-conventionalcommits": "^4.3.1" } }, "@commitlint/ensure": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-11.0.0.tgz", - "integrity": "sha512-/T4tjseSwlirKZdnx4AuICMNNlFvRyPQimbZIOYujp9DSO6XRtOy9NrmvWujwHsq9F5Wb80QWi4WMW6HMaENug==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/ensure/-/ensure-12.0.1.tgz", + "integrity": "sha512-XdBq+q1YBBDxWIAEjE3Y1YMbzhUnUuSLAEWD8SU1xsvEpQXWRYwDlMBRkjO7funNWTdL0ZQSkZDzme70imYjbw==", "dev": true, "requires": { - "@commitlint/types": "^11.0.0", + "@commitlint/types": "^12.0.1", "lodash": "^4.17.19" } }, "@commitlint/execute-rule": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-11.0.0.tgz", - "integrity": "sha512-g01p1g4BmYlZ2+tdotCavrMunnPFPhTzG1ZiLKTCYrooHRbmvqo42ZZn4QMStUEIcn+jfLb6BRZX3JzIwA1ezQ==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-12.0.1.tgz", + "integrity": "sha512-JzyweYfZlFLtXpgP+btzSY3YAkGPg61TqUSYQqBr4+5IaVf1FruMm5v4D5eLu9dAJuNKUfHbM3AEfuEPiZ79pg==", "dev": true }, "@commitlint/format": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-11.0.0.tgz", - "integrity": "sha512-bpBLWmG0wfZH/svzqD1hsGTpm79TKJWcf6EXZllh2J/LSSYKxGlv967lpw0hNojme0sZd4a/97R3qA2QHWWSLg==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/format/-/format-12.0.1.tgz", + "integrity": "sha512-rF79ipAxR8yFzPzG5tRoEZ//MRkyxCXj4JhpEjtdaCMBAXMssI8uazn3e5D8z4UFgSDe9qOnL0OmQvql7HTMoA==", "dev": true, "requires": { - "@commitlint/types": "^11.0.0", + "@commitlint/types": "^12.0.1", "chalk": "^4.0.0" } }, "@commitlint/is-ignored": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-11.0.0.tgz", - "integrity": "sha512-VLHOUBN+sOlkYC4tGuzE41yNPO2w09sQnOpfS+pSPnBFkNUUHawEuA44PLHtDvQgVuYrMAmSWFQpWabMoP5/Xg==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/is-ignored/-/is-ignored-12.0.1.tgz", + "integrity": "sha512-AplfLn5mX/kWTIiSolcOhTYcgphuGLX8FUr+HmyHBEqUkO36jt0z9caysH47fqU71ePtH63v1DWm+RYQ5RPDjg==", "dev": true, "requires": { - "@commitlint/types": "^11.0.0", - "semver": "7.3.2" + "@commitlint/types": "^12.0.1", + "semver": "7.3.4" + }, + "dependencies": { + "semver": { + "version": "7.3.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", + "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } } }, "@commitlint/lint": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-11.0.0.tgz", - "integrity": "sha512-Q8IIqGIHfwKr8ecVZyYh6NtXFmKw4YSEWEr2GJTB/fTZXgaOGtGFZDWOesCZllQ63f1s/oWJYtVv5RAEuwN8BQ==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/lint/-/lint-12.0.1.tgz", + "integrity": "sha512-1lKyRCq4ahJrY+Xxo8LsqCbALeJkodtEfpmYHeA5HpPMnK7lRSplLqOLcTCjoPfd4vO+gl6aDEZN+ow3YGQBOg==", "dev": true, "requires": { - "@commitlint/is-ignored": "^11.0.0", - "@commitlint/parse": "^11.0.0", - "@commitlint/rules": "^11.0.0", - "@commitlint/types": "^11.0.0" + "@commitlint/is-ignored": "^12.0.1", + "@commitlint/parse": "^12.0.1", + "@commitlint/rules": "^12.0.1", + "@commitlint/types": "^12.0.1" } }, "@commitlint/load": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-11.0.0.tgz", - "integrity": "sha512-t5ZBrtgvgCwPfxmG811FCp39/o3SJ7L+SNsxFL92OR4WQxPcu6c8taD0CG2lzOHGuRyuMxZ7ps3EbngT2WpiCg==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-12.0.1.tgz", + "integrity": "sha512-dX8KdCWn7w0bTkkk3zKQpe9X8vsTRa5EM+1ffF313wCX9b6tGa9vujhEHCkSzKAbbE2tFV64CHZygE7rtlHdIA==", "dev": true, "requires": { - "@commitlint/execute-rule": "^11.0.0", - "@commitlint/resolve-extends": "^11.0.0", - "@commitlint/types": "^11.0.0", - "chalk": "4.1.0", + "@commitlint/execute-rule": "^12.0.1", + "@commitlint/resolve-extends": "^12.0.1", + "@commitlint/types": "^12.0.1", + "chalk": "^4.0.0", "cosmiconfig": "^7.0.0", "lodash": "^4.17.19", "resolve-from": "^5.0.0" } }, "@commitlint/message": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-11.0.0.tgz", - "integrity": "sha512-01ObK/18JL7PEIE3dBRtoMmU6S3ecPYDTQWWhcO+ErA3Ai0KDYqV5VWWEijdcVafNpdeUNrEMigRkxXHQLbyJA==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-12.0.1.tgz", + "integrity": "sha512-fXuoxRC+NT1wEQi6p8oHfT7wvWIRgTk+udlRJnWTjmMpiYzVnMmmZfasdShirWr4TtxQtMyL+5DVgh7Y98kURw==", "dev": true }, "@commitlint/parse": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-11.0.0.tgz", - "integrity": "sha512-DekKQAIYWAXIcyAZ6/PDBJylWJ1BROTfDIzr9PMVxZRxBPc1gW2TG8fLgjZfBP5mc0cuthPkVi91KQQKGri/7A==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/parse/-/parse-12.0.1.tgz", + "integrity": "sha512-7oEGASmzBnHir5jSIR7KephXrKh7rIi9a6RpH1tOT+CIENYvhe8EDtIy29qMt+RLa2LlaPF7YrAgaJRfzG0YDQ==", "dev": true, "requires": { - "conventional-changelog-angular": "^5.0.0", + "@commitlint/types": "^12.0.1", + "conventional-changelog-angular": "^5.0.11", "conventional-commits-parser": "^3.0.0" } }, "@commitlint/read": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-11.0.0.tgz", - "integrity": "sha512-37V0V91GSv0aDzMzJioKpCoZw6l0shk7+tRG8RkW1GfZzUIytdg3XqJmM+IaIYpaop0m6BbZtfq+idzUwJnw7g==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/read/-/read-12.0.1.tgz", + "integrity": "sha512-baa0YeD4QOctEuthLpExQSi9xPiw0kDPfUVHqp8I88iuIXJECeS8S1+1GBiz89e8dLN9zmEE+sN9vtJHdAp9YA==", "dev": true, "requires": { - "@commitlint/top-level": "^11.0.0", + "@commitlint/top-level": "^12.0.1", + "@commitlint/types": "^12.0.1", "fs-extra": "^9.0.0", "git-raw-commits": "^2.0.0" } }, "@commitlint/resolve-extends": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-11.0.0.tgz", - "integrity": "sha512-WinU6Uv6L7HDGLqn/To13KM1CWvZ09VHZqryqxXa1OY+EvJkfU734CwnOEeNlSCK7FVLrB4kmodLJtL1dkEpXw==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-12.0.1.tgz", + "integrity": "sha512-Mvg0GDi/68Cqw893ha8uhxE8myHfPmiSSSi7d1x4VJNR4hoS37lBdX89kyx4i9NPmLfviY2cUJKTyK8ZrFznZw==", "dev": true, "requires": { "import-fresh": "^3.0.0", @@ -241,27 +243,27 @@ } }, "@commitlint/rules": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-11.0.0.tgz", - "integrity": "sha512-2hD9y9Ep5ZfoNxDDPkQadd2jJeocrwC4vJ98I0g8pNYn/W8hS9+/FuNpolREHN8PhmexXbkjrwyQrWbuC0DVaA==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/rules/-/rules-12.0.1.tgz", + "integrity": "sha512-A5O0ubNGugZR9WWxk5IVOLo07lpdUwhG5WkAW2lYpgZ7Z/2U4PLob9b4Ih1eHbQu+gnVeFr91k7F0DrpM7B8EQ==", "dev": true, "requires": { - "@commitlint/ensure": "^11.0.0", - "@commitlint/message": "^11.0.0", - "@commitlint/to-lines": "^11.0.0", - "@commitlint/types": "^11.0.0" + "@commitlint/ensure": "^12.0.1", + "@commitlint/message": "^12.0.1", + "@commitlint/to-lines": "^12.0.1", + "@commitlint/types": "^12.0.1" } }, "@commitlint/to-lines": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-11.0.0.tgz", - "integrity": "sha512-TIDTB0Y23jlCNubDROUVokbJk6860idYB5cZkLWcRS9tlb6YSoeLn1NLafPlrhhkkkZzTYnlKYzCVrBNVes1iw==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/to-lines/-/to-lines-12.0.1.tgz", + "integrity": "sha512-XwcJ1jY7x2fhudzbGMpNQkTSMVrxWrI8bRMbVe3Abuu7RfYpFf7VXAlhtnLfxBoagaK7RxjC2+eRidp/3txQBg==", "dev": true }, "@commitlint/top-level": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-11.0.0.tgz", - "integrity": "sha512-O0nFU8o+Ws+py5pfMQIuyxOtfR/kwtr5ybqTvR+C2lUPer2x6lnQU+OnfD7hPM+A+COIUZWx10mYQvkR3MmtAA==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/top-level/-/top-level-12.0.1.tgz", + "integrity": "sha512-rHdgt7U24GEau2/9i2vEAbksxkBRiVjHj5ECFL5dd0AJOIvaK++vMg4EF/ME0X/1yd9qVTHTNOl2Q4tTFK7VBQ==", "dev": true, "requires": { "find-up": "^5.0.0" @@ -307,10 +309,13 @@ } }, "@commitlint/types": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-11.0.0.tgz", - "integrity": "sha512-VoNqai1vR5anRF5Tuh/+SWDFk7xi7oMwHrHrbm1BprYXjB2RJsWLhUrStMssDxEl5lW/z3EUdg8RvH/IUBccSQ==", - "dev": true + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/@commitlint/types/-/types-12.0.1.tgz", + "integrity": "sha512-FsNDMV0W7D19/ZbR412klpqAilXASx75Neqh7jPtK278IEwdukOg3vth1r5kTm+BjDScM7wMUEOwIW3NNfAtwg==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } }, "@eslint/eslintrc": { "version": "0.2.2", @@ -747,14 +752,27 @@ } }, "cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, "requires": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" + "wrap-ansi": "^7.0.0" + }, + "dependencies": { + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + } + } } }, "color-convert": { @@ -813,248 +831,29 @@ } }, "concurrently": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.3.0.tgz", - "integrity": "sha512-8MhqOB6PWlBfA2vJ8a0bSFKATOdWlHiQlk11IfmQBPaHVP8oP2gsh2MObE6UR3hqDHqvaIvLTyceNW6obVuFHQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.0.0.tgz", + "integrity": "sha512-Ik9Igqnef2ONLjN2o/OVx1Ow5tymVvvEwQeYCQdD/oV+CN9oWhxLk7ibcBdOtv0UzBqHCEKRwbKceYoTK8t3fQ==", "dev": true, "requires": { - "chalk": "^2.4.2", - "date-fns": "^2.0.1", - "lodash": "^4.17.15", - "read-pkg": "^4.0.1", - "rxjs": "^6.5.2", + "chalk": "^4.1.0", + "date-fns": "^2.16.1", + "lodash": "^4.17.20", + "read-pkg": "^5.2.0", + "rxjs": "^6.6.3", "spawn-command": "^0.0.2-1", - "supports-color": "^6.1.0", + "supports-color": "^8.1.0", "tree-kill": "^1.2.2", - "yargs": "^13.3.0" + "yargs": "^16.2.0" }, "dependencies": { - "ansi-regex": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", - "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", - "dev": true - }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "dependencies": { - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "cliui": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz", - "integrity": "sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA==", - "dev": true, - "requires": { - "string-width": "^3.1.0", - "strip-ansi": "^5.2.0", - "wrap-ansi": "^5.1.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "hosted-git-info": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz", - "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "normalize-package-data": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", - "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", - "dev": true, - "requires": { - "hosted-git-info": "^2.1.4", - "resolve": "^1.10.0", - "semver": "2 || 3 || 4 || 5", - "validate-npm-package-license": "^3.0.1" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "read-pkg": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-4.0.1.tgz", - "integrity": "sha1-ljYlN48+HE1IyFhytabsfV0JMjc=", - "dev": true, - "requires": { - "normalize-package-data": "^2.3.2", - "parse-json": "^4.0.0", - "pify": "^3.0.0" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, "supports-color": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz", - "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==", + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, "requires": { - "has-flag": "^3.0.0" - } - }, - "wrap-ansi": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz", - "integrity": "sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.0", - "string-width": "^3.0.0", - "strip-ansi": "^5.0.0" - } - }, - "yargs": { - "version": "13.3.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", - "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", - "dev": true, - "requires": { - "cliui": "^5.0.0", - "find-up": "^3.0.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^3.0.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^13.1.2" - } - }, - "yargs-parser": { - "version": "13.1.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", - "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" + "has-flag": "^4.0.0" } } } @@ -1372,12 +1171,6 @@ "q": "^1.5.1" } }, - "core-js": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.9.1.tgz", - "integrity": "sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg==", - "dev": true - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", @@ -1430,9 +1223,9 @@ "dev": true }, "date-fns": { - "version": "2.17.0", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.17.0.tgz", - "integrity": "sha512-ZEhqxUtEZeGgg9eHNSOAJ8O9xqSgiJdrL0lzSSfMF54x6KXWJiOH/xntSJ9YomJPrYH/p08t6gWjGWq1SDJlSA==", + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.19.0.tgz", + "integrity": "sha512-X3bf2iTPgCAQp9wvjOQytnf5vO5rESYRXlPIVcgSbtT5OTScPcsf9eZU+B/YIkKAtYr5WeCii58BgATrNitlWg==", "dev": true }, "dateformat": { @@ -1718,9 +1511,9 @@ } }, "eslint-config-prettier": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz", - "integrity": "sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.1.0.tgz", + "integrity": "sha512-oKMhGv3ihGbCIimCAjqkdzx2Q+jthoqnXSP+d86M9tptwugycmTFdVR4IpLgq2c4SHifbwO90z2fQ8/Aio73yw==", "dev": true }, "eslint-plugin-json": { @@ -3677,12 +3470,6 @@ "strip-indent": "^3.0.0" } }, - "regenerator-runtime": { - "version": "0.13.7", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", - "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", - "dev": true - }, "regexpp": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", @@ -3704,12 +3491,6 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, - "require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, "resolve": { "version": "1.20.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", @@ -3802,12 +3583,6 @@ "integrity": "sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==", "dev": true }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, "shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -4533,12 +4308,6 @@ "isexe": "^2.0.0" } }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, "which-pm-runs": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", @@ -4589,12 +4358,6 @@ "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true }, - "y18n": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", - "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", - "dev": true - }, "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -4608,33 +4371,25 @@ "dev": true }, "yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, "requires": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" }, "dependencies": { - "yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "requires": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - } + "y18n": { + "version": "5.0.5", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", + "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "dev": true } } }, diff --git a/package.json b/package.json index 31bbff3a..1138beff 100644 --- a/package.json +++ b/package.json @@ -35,15 +35,15 @@ "@actions/exec": "1.0.4" }, "devDependencies": { - "@commitlint/cli": "11.0.0", - "@commitlint/config-conventional": "11.0.0", + "@commitlint/cli": "12.0.1", + "@commitlint/config-conventional": "12.0.1", "@types/node": "13.13.45", "@typescript-eslint/eslint-plugin": "4.6.0", "@typescript-eslint/parser": "4.6.0", "@vercel/ncc": "0.27.0", - "concurrently": "5.3.0", + "concurrently": "6.0.0", "eslint": "7.12.1", - "eslint-config-prettier": "7.2.0", + "eslint-config-prettier": "8.1.0", "eslint-plugin-json": "2.1.2", "eslint-plugin-prettier": "3.1.4", "husky": "4.3.8", diff --git a/src/docker.ts b/src/docker.ts index f66442e7..56b17b12 100644 --- a/src/docker.ts +++ b/src/docker.ts @@ -1,7 +1,7 @@ class Docker { readonly repository = 'renovate/renovate'; // renovate: datasource=docker depName=renovate/renovate versioning=docker - readonly tag = '24.76.0-slim'; + readonly tag = '24.77.2-slim'; readonly tagSuffix = '-slim'; image(): string { diff --git a/src/index.ts b/src/index.ts index 012c7f52..a1ea74e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,7 @@ import Renovate from './renovate'; async function run(): Promise { try { const input = new Input(); - const renovate = new Renovate(input.configurationFile, input.token); + const renovate = new Renovate(input); await renovate.runDockerContainer(); } catch (error) { diff --git a/src/input.ts b/src/input.ts index 207a394c..48b4749f 100644 --- a/src/input.ts +++ b/src/input.ts @@ -1,20 +1,98 @@ import * as core from '@actions/core'; +import path from 'path'; + +interface EnvironmentVariable { + key: string; + value: string; +} class Input { - readonly configurationFile = core.getInput('configurationFile', { - required: true, - }); - readonly token = core.getInput('token', { required: true }); + readonly options = { + envRegex: /^(?:RENOVATE_\w+|LOG_LEVEL)$/, + configurationFile: { + input: 'configurationFile', + env: 'RENOVATE_CONFIG_FILE', + optional: true, + }, + token: { + input: 'token', + env: 'RENOVATE_TOKEN', + optional: false, + }, + } as const; + readonly token: Readonly; + + private readonly _environmentVariables: Map; + private readonly _configurationFile: Readonly; constructor() { - this.validate(); + this._environmentVariables = new Map( + Object.entries(process.env).filter(([key]) => + this.options.envRegex.test(key) + ) + ); + + this.token = this.get( + this.options.token.input, + this.options.token.env, + this.options.token.optional + ); + this._configurationFile = this.get( + this.options.configurationFile.input, + this.options.configurationFile.env, + this.options.configurationFile.optional + ); } - validate(): void { - if (this.token === '') { - throw new Error('input.token MUST NOT be empty'); + configurationFile(): EnvironmentVariable | null { + if (this._configurationFile.value !== '') { + return { + key: this._configurationFile.key, + value: path.resolve(this._configurationFile.value), + }; } + + return null; + } + + /** + * Convert to environment variables. + * + * @note The environment variables listed below are filtered out. + * - Token, available with the `token` property. + * - Configuration file, available with the `configurationFile()` method. + */ + toEnvironmentVariables(): EnvironmentVariable[] { + return [...this._environmentVariables].map(([key, value]) => ({ + key, + value, + })); + } + + private get( + input: string, + env: string, + optional: boolean + ): EnvironmentVariable { + const fromInput = core.getInput(input); + const fromEnv = this._environmentVariables.get(env); + + if (fromInput === '' && fromEnv === undefined && !optional) { + throw new Error( + [ + `'${input}' MUST be passed using its input or the '${env}'`, + 'environment variable', + ].join(' ') + ); + } + + this._environmentVariables.delete(env); + if (fromInput !== '') { + return { key: env, value: fromInput }; + } + return { key: env, value: fromEnv !== undefined ? fromEnv : '' }; } } export default Input; +export { EnvironmentVariable, Input }; diff --git a/src/renovate.ts b/src/renovate.ts index 0f83d5c9..b019d11c 100644 --- a/src/renovate.ts +++ b/src/renovate.ts @@ -1,20 +1,16 @@ import Docker from './docker'; +import { Input } from './input'; import { exec } from '@actions/exec'; import fs from 'fs'; import path from 'path'; class Renovate { - private configFileEnv = 'RENOVATE_CONFIG_FILE'; - private tokenEnv = 'RENOVATE_TOKEN'; private dockerGroupName = 'docker'; private configFileMountDir = '/github-action'; - private configFile: string; private docker: Docker; - constructor(configFile: string, private token: string) { - this.configFile = path.resolve(configFile); - + constructor(private input: Input) { this.validateArguments(); this.docker = new Docker(); @@ -22,18 +18,30 @@ class Renovate { async runDockerContainer(): Promise { const renovateDockerUser = 'ubuntu'; - const githubActionsDockerGroupId = this.getDockerGroupId(); - const commandArguments = [ + + const dockerArguments = this.input + .toEnvironmentVariables() + .map((e) => `--env ${e.key}`) + .concat([`--env ${this.input.token.key}=${this.input.token.value}`]); + + if (this.input.configurationFile() !== null) { + const baseName = path.basename(this.input.configurationFile().value); + const mountPath = path.join(this.configFileMountDir, baseName); + dockerArguments.push( + `--env ${this.input.configurationFile().key}=${mountPath}`, + `--volume ${this.input.configurationFile().value}:${mountPath}` + ); + } + + dockerArguments.push( + '--volume /var/run/docker.sock:/var/run/docker.sock', + '--volume /tmp:/tmp', + `--user ${renovateDockerUser}:${this.getDockerGroupId()}`, '--rm', - `--env ${this.configFileEnv}=${this.configFileMountPath()}`, - `--env ${this.tokenEnv}=${this.token}`, - `--volume ${this.configFile}:${this.configFileMountPath()}`, - `--volume /var/run/docker.sock:/var/run/docker.sock`, - `--volume /tmp:/tmp`, - `--user ${renovateDockerUser}:${githubActionsDockerGroupId}`, - this.docker.image(), - ]; - const command = `docker run ${commandArguments.join(' ')}`; + this.docker.image() + ); + + const command = `docker run ${dockerArguments.join(' ')}`; const code = await exec(command); if (code !== 0) { @@ -71,20 +79,21 @@ class Renovate { } private validateArguments(): void { - if (!fs.existsSync(this.configFile)) { + if (/\s/.test(this.input.token.value)) { + throw new Error('Token MUST NOT contain whitespace'); + } + + const configurationFile = this.input.configurationFile(); + if ( + configurationFile !== null && + (!fs.existsSync(configurationFile.value) || + !fs.statSync(configurationFile.value).isFile()) + ) { throw new Error( - `Could not locate configuration file '${this.configFile}'.` + `configuration file '${configurationFile.value}' MUST be an existing file` ); } } - - private configFileName(): string { - return path.basename(this.configFile); - } - - private configFileMountPath(): string { - return path.join(this.configFileMountDir, this.configFileName()); - } } export default Renovate;