Skip to content

Commit

Permalink
ci(auto-merge): simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
tekumara committed Dec 7, 2024
1 parent b83face commit 40b75b7
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
id: dependabot-metadata
uses: dependabot/fetch-metadata@v2

- name: Set PR title for typos-cli updates
- name: Set PR title with feat prefix for typos-cli updates
if: contains(steps.dependabot-metadata.outputs.dependency-names, 'typos-cli')
uses: actions/github-script@v7
env:
Expand All @@ -27,21 +27,19 @@ jobs:
const prNumber = context.payload.pull_request.number;
const newVersion = process.env.NEW_VERSION;
// Find line with dictionary update, eg: "Updated the dictionary with the November 2024 changes"
// Find dictionary date from line like "Updated the dictionary with the November 2024 changes"
let dict_date;
const dictionaryRegex = /(Updated the dictionary.*)/;
const dateRegex = /(?:January|February|March|April|May|June|July|August|September|October|November|December)\s+\d{4}/;
const regex = /Updated the dictionary.*?((?:January|February|March|April|May|June|July|August|September|October|November|December)\s+\d{4})/;
for (const line of prBody.split('\n')) {
const match = line.match(dictionaryRegex);
const match = line.match(regex);
if (match) {
const dateMatch = match[1].match(dateRegex);
dict_date = dateMatch ? dateMatch[0] : '';
dict_date = match[1];
break;
}
}
// Set PR title with dictionary date (if any)
// Set PR title with feat prefix and dictionary date (if any)
const title = `feat(typos): version ${newVersion}` + (dict_date ? ` - ${dict_date} dictionary update` : '');
console.log(title);
Expand Down

0 comments on commit 40b75b7

Please sign in to comment.