Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(template): add equals helper #21385

Merged
merged 3 commits into from
Apr 9, 2023

Commits on Apr 7, 2023

  1. feat(template): add ifEquals helper

    As an example of a use case for this is that I define package sources
    using [purls](https://github.com/package-url/purl-spec) where the
    `pkg:github` type defaults to use `datasource=github-releases`. I also
    allow overriding the datasource via comments, such as `#
    renovate=datasource=git-refs`. When doing so, I also have the need to
    modify the `packageName` to be compatible with the `git-refs`
    datasource, for example:
    
    ```yaml
    id: pkg:github/renovatebot/renovate@116735f
    ```
    
    This will end up producing a renovate dependency with roughly the
    following structure:
    
    ```json
    {
      "datasource": "git-refs",
      "packageName": "renovatebot/renovate"
    }
    ```
    
    In my `regexManager`, I'd like to modify `packageName` to include
    https://github.com/ to make it compatible with `git-refs`:
    
    ```json
    "packageNameTemplate": "{{#ifEquals datasource 'git-refs'}}https://github.com/{{packageName}}{{else}}{{packageName}}{{/if}}",
    ```
    
    For this, I'd need the ability to check if a value is equal to
    something (`#ifEquals`), hence this PR.
    williamboman committed Apr 7, 2023
    Configuration menu
    Copy the full SHA
    ef46fe7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a426d3e View commit details
    Browse the repository at this point in the history

Commits on Apr 8, 2023

  1. Configuration menu
    Copy the full SHA
    9bf1bf0 View commit details
    Browse the repository at this point in the history