Skip to content

Detect and propose Renovate presets for new workspaces #10

Detect and propose Renovate presets for new workspaces

Detect and propose Renovate presets for new workspaces #10

name: Detect and propose Renovate presets for new workspaces
on:
schedule:
- cron: "0 6 * * 1" # Every Monday at 06:00 UTC
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: new-workspace-presets
cancel-in-progress: false
jobs:
prepare:
name: Detect uncovered workspaces
runs-on: ubuntu-latest
outputs:
workspaces: ${{ steps.detect.outputs.workspaces }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
with:
egress-policy: audit
- name: Checkout main
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: main
token: ${{ secrets.RHDH_BOT_TOKEN }}
fetch-depth: 1
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- name: Install dependencies
run: yarn install --immutable
- name: Detect new workspaces
id: detect
run: echo "workspaces=$(node scripts/ci/detect-new-workspaces.js --list | jq -c .)" >> $GITHUB_OUTPUT
propose:
name: Propose preset for workspace
runs-on: ubuntu-latest
needs: prepare
if: needs.prepare.outputs.workspaces != '[]' && needs.prepare.outputs.workspaces != ''
strategy:
matrix:
workspace: ${{ fromJSON(needs.prepare.outputs.workspaces) }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
with:
egress-policy: audit
- name: Checkout main
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: main
token: ${{ secrets.RHDH_BOT_TOKEN }}
fetch-depth: 1
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
- name: Install dependencies
run: yarn install --immutable
- name: Apply changes for workspace
id: apply
run: node scripts/ci/detect-new-workspaces.js --apply "${{ matrix.workspace }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
token: ${{ secrets.RHDH_BOT_TOKEN }}
base: main
branch: automation/add-renovate-presets-${{ matrix.workspace }}
commit-message: "chore: add Renovate presets for ${{ matrix.workspace }}"
title: "chore: add Renovate presets for ${{ matrix.workspace }}"
body: |
This PR adds Renovate presets for the new `${{ matrix.workspace }}` workspace.
Extends: base minor/patch/devdependency presets.
Created by [Detect New Workspace ${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
signoff: true
add-paths: |
.github/renovate-presets/workspace/*.json
.github/renovate.json