How to run/test renovate bot locally?

735 views Asked by At

Before I configure renovate to work with my Azure pipeline, how can I run npx renovate locally to check does it work as I expect and does my config file is well configured. I'm trying with npx renovate --platform local command.

My project is based on JS/React so I have installed renovate via npm.

I'm getting warn message: Unknown error fetching default owner preset

this is my config.js file: `const config = { extends: ['config:recommended'], };

export default config;`

I've found inside renovate documentation something related to local presets but not sure how can I configure or set it.

documentation: Local presetsĀ¶ Renovate also supports local presets, e.g. presets that are hosted on the same platform as the target repository. This is especially helpful in self-hosted scenarios where public presets cannot be used. Local presets are specified either by leaving out any prefix, e.g. owner/name, or explicitly by adding a local> prefix, e.g. local>owner/name. Renovate will determine the current platform and look up the preset from there.

info from console:

INFO: Repository finished (repository=local) "cloned": undefined, "durationMs": 434 INFO: Renovate is exiting with a non-zero code due to the following logged errors "loggerErrors": [ { "name": "renovate", "level": 50, "logContext": "LHh5xmukB832iVr6l_qFS", "repository": "local", "err": { "message": "Cannot read properties of undefined (reading '')", "stack": "TypeError: Cannot read properties of undefined (reading '')\n

this is my renovate.json file:

{
  "onboardingConfig": { "extends": ["config:recommended"] },
  "packageRules": [
    {
      "matchPackageNames": ["*"],
      "automerge": false
    }
  ]
}

this is my config.js file

module.exports = {
  platform: 'azure',
  endpoint: 'https://dev.azure.com/myend-point/',
  token: process.env.TOKEN,
  hostRules: [
    {
      hostType: 'npm',
      matchHost: 'pkgs.dev.azure.com',
      username: 'apikey',
      password: process.env.TOKEN,
    },
  ],
  repositories: ['my repository'],
};

Any help is more than welcome!

1

There are 1 answers

0
Ali Hassan On

If you want to validate the renovate.json only then you can use the following command to validate it locally.

npx --package renovate -c 'renovate-config-validator'

You could automate it and put the following action in the github actions to make it as part of your CI/CD workflow.

name: Renovate

on:
  pull_request_target:
    types:
    - opened
    - edited
    - synchronize
    paths:
    - .github/workflows/renovate.yaml
    - renovate.json

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v4
    - name: Renovate Config Validation
      uses: rinchsan/[email protected]
      with:
        pattern: 'renovate.json'