Skip to content

Commit

Permalink
use js
Browse files Browse the repository at this point in the history
easier
  • Loading branch information
mmkal committed Aug 13, 2024
1 parent 261fa18 commit 7705842
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,17 @@ jobs:
})
const {deps_branch: head, main_branch: base} = process.env
const prTitle = '${{ steps.deps_diff.outputs.pr_title }}'
const updateCommits = '${{ steps.deps_diff.outputs.update_commits }}'
const childProcess = require('child_process')
const updateCommits = childProcess.execSync('git --no-pager log --oneline --no-merges main..deps').toString().trim().split('\n')
const updatedDeps = updateCommits
.map(line => line.match(/update dependency (.+) to/))
.filter(Boolean)
.map(match => match[1])
const prTitle = updatedDeps.length <= 4
? `chore: update dependencies ${updatedDeps.join(', ')}`
: `chore: update dependencies ${updatedDeps.slice(0, 3).join(', ')} and ${updatedDeps.length - 3} more`
console.log({prTitle, updateCommits})
const prBody = [
'This PR was automatically created by the ${{ github.workflow }} workflow.',
Expand All @@ -126,7 +135,7 @@ jobs:
'',
'### Updates included:',
'',
updateCommits.replace(/\s*[a-f0-9]{7} chore/g, m => '\n- ' + m.trim()),
updateCommits.map(commit => `- ${commit}`).join('\n'),
].join('\n')
for await (const {data: pulls} of iterator) {
Expand Down

0 comments on commit 7705842

Please sign in to comment.