Skip to content

Commit

Permalink
simplified message formating
Browse files Browse the repository at this point in the history
  • Loading branch information
peterkogo committed Oct 30, 2024
1 parent eea61b4 commit f721b61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/createWhatsNew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,11 @@ jobs:
git config --global user.name 'github-actions[bot]'
- name: 'Create branch'
run: git checkout -b ${{ env.BRANCH }}
- name: 'Remove Thanks'
- name: 'Format Release Message'
run: |
{
echo 'CLEAN_BODY<<EOF'
BODY="${BODY}" node .github/workflows/scripts/removeThanks.js
echo EOF
} >> "$GITHUB_ENV"
- name: 'Remove Commits'
run: |
{
echo 'CLEAN_BODY<<EOF'
BODY="${CLEAN_BODY}" node .github/workflows/scripts/removeCommits.js
echo EOF
} >> "$GITHUB_ENV"
- name: 'Remove Updated Dependencies'
run: |
{
echo 'CLEAN_BODY<<EOF'
BODY="${CLEAN_BODY}" node .github/workflows/scripts/removeUpdateDeps.js
BODY="${BODY}" node .github/workflows/scripts/formatRelease.js
echo EOF
} >> "$GITHUB_ENV"
- name: 'Post to Discord'
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/scripts/formatRelease.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const removeThanks =
/Thanks \[@(?:moklick|peterkogo|hayleigh-dot-dev|chrtze|bcakmakoglu)\]\(.*\)! \- */g;
const removeCommits = /(\[.*\]\(.*\)) (\[.*\]\(.*\)) /g;
const removeDeps = /- *Updated dependencies.*/gs;
const removeNewlines = /\n\n/g;

(async () => {
const body = process.env.BODY;
let newBody = body
.replaceAll(removeThanks, '')
.replaceAll(removeCommits, '$1 ')
.replaceAll(removeDeps, '')
.replaceAll(removeNewlines, '\n');
console.log(newBody);
})();
1 change: 1 addition & 0 deletions .github/workflows/scripts/postToDiscord.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const content = `Hey [INSERT MENTION HERE],
**${process.env.FRAMEWORK} Flow ${process.env.VERSION}** is out!
${process.env.CLEAN_BODY}
`;

Expand Down

0 comments on commit f721b61

Please sign in to comment.