diff --git a/renovate-changesets/action.yaml b/renovate-changesets/action.yaml index 6e01851..d9c7561 100644 --- a/renovate-changesets/action.yaml +++ b/renovate-changesets/action.yaml @@ -1,10 +1,14 @@ -name: Backstage Renovate Changeset Creator -description: Create changesets on the renovate bot PR's if needed +name: Backstage Dependency Manager Changeset Creator +description: Create changesets on the dependency manager bot PR's if needed inputs: multiple-workspaces: description: If it's this repository is a collection of workspaces required: false default: 'false' + dependency-manager: + description: The dependency manager to use + required: false + default: 'renovate' outputs: {} runs: diff --git a/renovate-changesets/dependencyConfig.ts b/renovate-changesets/dependencyConfig.ts new file mode 100644 index 0000000..49ee232 --- /dev/null +++ b/renovate-changesets/dependencyConfig.ts @@ -0,0 +1,10 @@ +import * as core from '@actions/core'; + +export const getDependencyManager = (): string => { + return core + .getInput('dependency-manager', { + required: false, + }) + .trim() + .toLowerCase(); +}; diff --git a/renovate-changesets/index.ts b/renovate-changesets/index.ts index c89fbc5..af858ae 100644 --- a/renovate-changesets/index.ts +++ b/renovate-changesets/index.ts @@ -7,11 +7,12 @@ import { getChangedFiles, getChangesetFilename, listPackages, -} from './renovateChangesets'; +} from './manageChangesets'; import { relative as relativePath, resolve as resolvePath } from 'path'; +import { getDependencyManager } from './dependencyConfig'; async function main() { - core.info('Running Renovate Changesets'); + core.info(`Running ${getDependencyManager()} Changesets`); const isMultipleWorkspaces = core.getBooleanInput('multiple-workspaces', { required: false, @@ -19,8 +20,8 @@ async function main() { const branchName = await getBranchName(); - if (!branchName.startsWith('renovate/')) { - core.info('Not a renovate branch, skipping'); + if (!branchName.startsWith(getDependencyManager())) { + core.info(`Not a ${getDependencyManager()} branch, skipping`); return; } diff --git a/renovate-changesets/renovateChangesets.ts b/renovate-changesets/manageChangesets.ts similarity index 95% rename from renovate-changesets/renovateChangesets.ts rename to renovate-changesets/manageChangesets.ts index d37c280..27e7723 100644 --- a/renovate-changesets/renovateChangesets.ts +++ b/renovate-changesets/manageChangesets.ts @@ -2,6 +2,7 @@ import { getExecOutput, exec } from '@actions/exec'; import fs from 'fs/promises'; import { resolve as resolvePath, relative as relativePath } from 'path'; import { getPackages, type Package } from '@manypkg/get-packages'; +import { getDependencyManager } from './dependencyConfig'; export async function getBranchName() { const { stdout } = await getExecOutput('git', ['branch', '--show-current']); @@ -34,7 +35,7 @@ export async function getChangesetFilename() { const { stdout: shortHash } = await getExecOutput( 'git rev-parse --short HEAD', ); - return `.changeset/renovate-${shortHash.trim()}.md`; + return `.changeset/${getDependencyManager()}-${shortHash.trim()}.md`; } export async function createChangeset(