renovate

How to configure Renovate to update dependencies based on GitHub tags?


I would like Renovate to scan through a yml file and update this value using GitHub tags as the datasource, with these tags being in another GitHub repository. Both of the repositories are private and have Renovate installed on them.

Repo A - renovate-test

This repo contains the following in yml:

ref: refs/tags/exampleTag/1.0.0

Repo B - renovate-test-tags

exampleTag/1.0.0

Renovate Config

I have added the following in my Renovate config:

    "regexManagers": [
      {
        "fileMatch": [
          ".*y[a]?ml$"
        ],
        "matchStrings": [
          "refs\/tags\/(?<depName>.*)\/(?<currentValue>.*)"
        ],
        "datasourceTemplate": "github-tags"
      }
    ]

This leads to the following errors:

DEBUG: Datasource unknown error
{
  "datasource": "github-tags",
  "packageName": "exampleTag",
  "err": {
    "message": "Variable $name of type String! was provided invalid value",
    "stack": "Error: Variable $name of type String! was provided invalid value
  }
}
{
  "baseBranch": "main",
  "config": {
    "regex": [
      {
        "deps": [
          {
            "depName": "exampleTag",
            "currentValue": "1.0.0",
            "datasource": "github-tags",
            "replaceString": "refs/tags/exampleTag/1.0.0",
            "updates": [],
            "warnings": [
              {
                "topic": "exampleTag",
                "message": "Failed to look up github-tags dependency exampleTag"
              }
            ],
            "versioning": "semver"
          }
        ],
        "matchStrings": [
          "refs/tags/(?<depName>.*)/(?<currentValue>.*)"
        ],
        "datasourceTemplate": "github-tags",
        "packageFile": "pipeline.yml"
      }
    ]
  }
}

Additionally, would I need to specify registryUrlTemplate to point to the tags repo?
Something like https://github.com/<org_name>/renovate-test-tags


Solution

  • The message you are seeing is coming from the Github API.

    The github-tags datasource expects a depName in the style of <organization>/<repository> as seen in the url.

    If https://github.com/StackExchange/dnscontrol is the URL to the repository you want to have StackExchange/dnscontrol as depName.

    You can hardcode the ORG like this:

        "regexManagers": [
          {
            "fileMatch": [
              ".*y[a]?ml$"
            ],
            "matchStrings": [
              "refs\/tags\/(?<depName>.*)\/(?<currentValue>.*)"
            ],
            "datasourceTemplate": "github-tags",
            "depNameTemplate": "<org_name>/{{{depName}}}"
          }
        ]