Skip to content

Commit

Permalink
MIJN-9884-feature/Conditionally set release note headers (#1684)
Browse files Browse the repository at this point in the history
* Conditionally set note headers

* extracted repeated code into function

---------

Co-authored-by: Roan Paulus <[email protected]>
  • Loading branch information
OscarBakker and RoanPaulus authored Jan 7, 2025
1 parent d122c67 commit 59e5ab7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pr-title-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ jobs:
// Titel moet beginnen met mijn-xxxx-chore/feature/bug! todo mijn- patroon moet weggehaald worden wanneer de workflows van mijn-7620 gemerged zijn
const jiraPattern = /^MIJN-\d+-(CHORE|FEATURE|BUG)/i
const dependabotPattern = /^Build\(deps(-dev)?\): bump/
const disallowedQuotesPattern = /"/
if (!(jiraPattern.test(prTitle) || dependabotPattern.test(prTitle))) {
if (disallowedQuotesPattern.test(prTitle)) {
console.log('The PR title contains double quotes, which are not allowed!')
core.setFailed('PR title not valid. Please remove double quotes from the title.')
} else if (!(jiraPattern.test(prTitle) || dependabotPattern.test(prTitle))) {
console.log('The PR title does not match JIRA ticket format!')
// Fails the workflow
core.setFailed('PR title not valid. Please make sure this PR uses the JIRA ticket or dependabot format.')
} else {
console.log('PR title format is correct.')
Expand Down
29 changes: 13 additions & 16 deletions .github/workflows/release-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,22 +59,19 @@ jobs:
grep -iE 'BUG:|MIJN-[0-9]+-BUG' release_notes.txt > bugs.txt || true
grep -iE 'MIJN-[0-9]+($|[^-])' release_notes.txt > mijn.txt || true
echo "chores<<EOF" >> $GITHUB_OUTPUT
cat chores.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "features<<EOF" >> $GITHUB_OUTPUT
cat features.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "bugs<<EOF" >> $GITHUB_OUTPUT
cat bugs.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "mijn<<EOF" >> $GITHUB_OUTPUT
cat mijn.txt >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
shell: bash
- name: Output Categorized Notes
run: |
append_to_github_output() {
if [ -s "$1.txt" ]; then
echo "$1<<EOF" >> "$GITHUB_OUTPUT"
cat "$1.txt" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
fi
}
append_to_github_output 'chores'
append_to_github_output 'features'
append_to_github_output 'bugs'
append_to_github_output 'mijn'
- name: Create Customized Release Notes
id: custom_release_notes
Expand Down

0 comments on commit 59e5ab7

Please sign in to comment.