Skip to content

Detect and propose Renovate presets for new workspaces #44

Detect and propose Renovate presets for new workspaces

Detect and propose Renovate presets for new workspaces #44

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@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: Checkout main
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: main
token: ${{ secrets.RHDH_BOT_TOKEN }}
fetch-depth: 1
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
- 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@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0
with:
egress-policy: audit
- name: Checkout main
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
ref: main
token: ${{ secrets.RHDH_BOT_TOKEN }}
fetch-depth: 1
- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
- name: Install dependencies
run: yarn install --immutable
- name: Apply changes for workspace
id: apply
env:
WORKSPACE: ${{ matrix.workspace }}
run: node scripts/ci/detect-new-workspaces.js --apply "$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