Using branchNames per @Nishnha's suggestion

This commit is contained in:
Michael Waddell
2022-02-09 13:45:56 -06:00
parent 9967bee0ba
commit 74c5483adb
2 changed files with 4 additions and 2 deletions

1
dist/index.js generated vendored
View File

@@ -13410,6 +13410,7 @@ function parse(commitMessage, branchName, mainBranch) {
const yamlFragment = commitMessage.match(/^-{3}\n(?<dependencies>[\S|\s]*?)\n^\.{3}\n/m);
if ((yamlFragment === null || yamlFragment === void 0 ? void 0 : yamlFragment.groups) && branchName.startsWith('dependabot')) {
const data = yaml.parse(yamlFragment.groups.dependencies);
// Since we are on the `dependabot` branch (9 letters), the 10th letter in the branch name is the delimiter
const delim = branchName[10];
const chunks = branchName.split(delim);
const dirname = chunks.slice(2, -1).join(delim) || '/';

View File

@@ -7,7 +7,7 @@ import { hideBin } from 'yargs/helpers'
import { getMessage } from './dependabot/verified_commits'
import { parse } from './dependabot/update_metadata'
import { parseNwo } from './dependabot/util'
import { getBranchNames, parseNwo } from './dependabot/util'
async function check (args: any): Promise<void> {
try {
@@ -42,8 +42,9 @@ async function check (args: any): Promise<void> {
if (commitMessage) {
console.log('This appears to be a valid Dependabot Pull Request.')
const branchNames = getBranchNames(github.context)
const updatedDependencies = parse(commitMessage, 'dependabot/test_ecosystem/test_directory', 'test_branch')
const updatedDependencies = parse(commitMessage, branchNames.headName, branchNames.baseName)
if (updatedDependencies.length > 0) {
console.log('Updated dependencies:')