From 7593103e3666f35b5a143a59f0b7762a0cf2e1ba Mon Sep 17 00:00:00 2001 From: JohT <7671054+JohT@users.noreply.github.com> Date: Thu, 23 Jan 2025 07:48:23 +0100 Subject: [PATCH] Add renovate preset to update the public reusable GitHub Workflow --- .../internal-check-renovate-config.yml | 8 +++- .../workflows/internal-java-code-analysis.yml | 2 + .../internal-typescript-code-analysis.yml | 2 + INTEGRATION.md | 6 ++- renovate-presets/README.md | 33 +++++++++++++++++ ...raph-analysis-workflow-latest-digest.json5 | 37 +++++++++++++++++++ 6 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 renovate-presets/README.md create mode 100644 renovate-presets/code-graph-analysis-workflow-latest-digest.json5 diff --git a/.github/workflows/internal-check-renovate-config.yml b/.github/workflows/internal-check-renovate-config.yml index 8c87ee18c..da861012d 100644 --- a/.github/workflows/internal-check-renovate-config.yml +++ b/.github/workflows/internal-check-renovate-config.yml @@ -7,6 +7,7 @@ on: # Only watch root level Renovate configuration changes paths: - 'renovate.json*' + - 'renovate-presets/**' - '.github/workflows/internal-check-renovate-config.yml' # or when this file changed jobs: @@ -20,6 +21,11 @@ jobs: uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' + + - name: Get the list of all renovate presets and the main renovate configuration + id: set-renovate-config-files + run: | + echo "RENOVATE_CONFIG_FILES=$(find renovate-presets -type f -name '*.json' -o -name '*.json5') renovate.json" >> $GITHUB_ENV - name: Run renovate-config-validator - run: npx --yes --package renovate@39.91.2 -- renovate-config-validator + run: npx --yes --package renovate@39.91.2 -- renovate-config-validator ${{ env.RENOVATE_CONFIG_FILES }} diff --git a/.github/workflows/internal-java-code-analysis.yml b/.github/workflows/internal-java-code-analysis.yml index 71c9e571a..43bc829d4 100644 --- a/.github/workflows/internal-java-code-analysis.yml +++ b/.github/workflows/internal-java-code-analysis.yml @@ -15,6 +15,7 @@ on: - '.gitignore' - '.gitattributes' - 'renovate.json' + - 'renovate-presets/**' - 'changelogTemplate.mustache' - '**.code-workspace' - '.github/workflows/internal-typescript-code-analysis.yml' @@ -33,6 +34,7 @@ on: - '.gitignore' - '.gitattributes' - 'renovate.json' + - 'renovate-presets/**' - 'changelogTemplate.mustache' - '**.code-workspace' - '.github/workflows/internal-typescript-code-analysis.yml' diff --git a/.github/workflows/internal-typescript-code-analysis.yml b/.github/workflows/internal-typescript-code-analysis.yml index 50b4f18f4..65ca11a53 100644 --- a/.github/workflows/internal-typescript-code-analysis.yml +++ b/.github/workflows/internal-typescript-code-analysis.yml @@ -15,6 +15,7 @@ on: - '.gitignore' - '.gitattributes' - 'renovate.json' + - 'renovate-presets/**' - 'changelogTemplate.mustache' - '**.code-workspace' - '.github/workflows/internal-java-code-analysis.yml' @@ -33,6 +34,7 @@ on: - '.gitignore' - '.gitattributes' - 'renovate.json' + - 'renovate-presets/**' - 'changelogTemplate.mustache' - '**.code-workspace' - '.github/workflows/internal-java-code-analysis.yml' diff --git a/INTEGRATION.md b/INTEGRATION.md index aa14c052c..9b3c44cf5 100644 --- a/INTEGRATION.md +++ b/INTEGRATION.md @@ -4,7 +4,7 @@ This document describes the steps to get started as quickly as possible. :point_right: For more details on what else you can do see [README](./README.md). :point_right: For more details on how to analyze your code locally see [GETTING_STARTED](./GETTING_STARTED.md). -## :rocket: How to use it +## :rocket: How to integrate it This repository provides a reusable GitHub Actions Workflow to analyze code. The workflow is defined in [public-analyze-code-graph.yml](./.github/workflows/public-analyze-code-graph.yml). @@ -23,6 +23,10 @@ You can find examples in: :warning: Note: Workflows with names starting with `internal-` are private and should not be used outside this repository. They may change at any time without notice. +## :repeat: How to update it with Renovate + +This repository provides a Renovate presets to update the code graph analysis pipeline workflow. The presets are defined in the folder [renovate-presets](./renovate-presets). Example: [code-graph-analysis-workflow-latest-digest.json5](./renovate-presets/code-graph-analysis-workflow-latest-digest.json5). More details can be found in [renovate-presets/README.md](./renovate-presets/README.md). + ## :gear: Parameters The workflow parameters are as follows: diff --git a/renovate-presets/README.md b/renovate-presets/README.md new file mode 100644 index 000000000..c406ce4ac --- /dev/null +++ b/renovate-presets/README.md @@ -0,0 +1,33 @@ +# Renovate Presets + +This folder contains Renovate presets for updating the code graph analysis workflow. These presets are designed to be used in other repositories to streamline and automate dependency updates. + +## Available Presets + +### Code Graph Analysis Workflow + +This preset is designed to update the dependencies and configurations related to the code graph analysis workflow. + +## Usage + +To use a preset from this folder in your repository, add the following to your `renovate.json` configuration: + +```json +{ + "extends": [ + "github>JohT/code-graph-analysis-pipeline//renovate-presets/.json5" + ] +} +``` + +Replace `` with the name of the preset you want to use, e.g., `code-graph-analysis-workflow-latest-digest`. + +## Future Presets + +In the future, more presets with different options may be added to this folder. These presets will also be publicly available for use in other repositories. + +## References + +- Available configuration options: https://docs.renovatebot.com/configuration-options +- Shareable configuration presets: https://docs.renovatebot.com/config-presets +- Update of GitHub Actions: https://docs.renovatebot.com/modules/manager/github-actions diff --git a/renovate-presets/code-graph-analysis-workflow-latest-digest.json5 b/renovate-presets/code-graph-analysis-workflow-latest-digest.json5 new file mode 100644 index 000000000..6af9e6298 --- /dev/null +++ b/renovate-presets/code-graph-analysis-workflow-latest-digest.json5 @@ -0,0 +1,37 @@ +// References: +// - JSON5: https://json5.org +// - Available configuration options: https://docs.renovatebot.com/configuration-options +// - Shareable configuration presets: https://docs.renovatebot.com/config-presets +// - Update of GitHub Actions: https://docs.renovatebot.com/modules/manager/github-actions +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "description": "Keep the pinned code-graph-analysis-pipeline GitHub Workflow up-to-date with the latest digest (commit hash) of a specific branch or tag", + "packageRules": [ + { + // Keeps the GitHub Actions update of code-graph-analysis-pipeline and the update of its "ref" parameter value in sync. + "description": "Code Graph Analysis Pipeline Workflow", + "groupName": "Code Graph Analysis Pipeline Workflow", + "matchPackageNames": [ + "JohT/code-graph-analysis-pipeline", + "https://github.com/JohT/code-graph-analysis-pipeline" + ] + } + ], + "customManagers": [ + { + "description": "Update code-graph-analysis-pipeline public shared workflow's ref parameter", + "customType": "regex", + "fileMatch": [ + "(^|/)(workflow-templates|\\.(?:github|gitea|forgejo)/(?:workflows|actions))/.+\\.ya?ml$", + "(^|/)action\\.ya?ml$" + ], + "matchStringsStrategy": "combination", + "matchStrings": [ + "uses: JohT/code-graph-analysis-pipeline/\\.github/workflows/public-analyze-code-graph\\.yml*\\s*", + "ref:\\s*(?.*?)\\s+#\\s+(?.*?)\\s+" + ], + "packageNameTemplate": "https://github.com/JohT/code-graph-analysis-pipeline", + "datasourceTemplate": "git-refs" + } + ] +} \ No newline at end of file