Skip to content

Commit

Permalink
πŸ‘· Automatically add Commits since last Commit to Bump PR
Browse files Browse the repository at this point in the history
  • Loading branch information
joshkreud committed Feb 27, 2024
1 parent ac79743 commit 1ed5538
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,56 @@ jobs:
git commit -m "πŸ”– Package ${{ steps.bump_version.outputs.PRE_BUMP_VERSION }} to ${{ steps.bump_version.outputs.BUMPED_VERSION }}"
- name: Git push
run: |
git push origin release
git push origin release --force
- name: Create Pull Request
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
let page = 1;
let bumpCommits = [];
let shouldContinue = true;
while (shouldContinue) {
const { data: commits } = await github.rest.repos.listCommits({
owner: owner,
repo: repo,
per_page: 100,
page: page++
});
for (const commit of commits) {
if (commit.commit.message.startsWith('πŸ”– Package')) {
shouldContinue = false;
break;
} else {
const commitLink = `- [${commit.commit.message}](${commit.html_url})`;
bumpCommits.push(commitLink);
}
}
if (commits.length < 100) {
// Break on last page
shouldContinue = false;
}
}
let bodyText = [
'Bumps Package Version ${{ steps.bump_version.outputs.PRE_BUMP_VERSION }} --> ${{ steps.bump_version.outputs.BUMPED_VERSION }},',
'',
'# What\'s Changed',
'',
...bumpCommits
].join('\n');
console.log("PR Text: ", bodyText)
const result = await github.rest.pulls.create({
title: 'πŸ”– Bump to Version: ${{ steps.bump_version.outputs.BUMPED_VERSION }}',
owner,
repo,
head: 'release',
base: 'main',
body: [
'Bumps Package Version ${{ steps.bump_version.outputs.PRE_BUMP_VERSION }} --> ${{ steps.bump_version.outputs.BUMPED_VERSION }}',
"",
"# What's new?",
"- "
].join('\n')
body: bodyText,
});
github.rest.issues.addLabels({
owner,
Expand Down

0 comments on commit 1ed5538

Please sign in to comment.