Skip to content

Commit a48ad98

Browse files
GHA-160 Add Issue Type Configuration to Automated Release for Release Note Generation (#75)
1 parent c3d908f commit a48ad98

File tree

2 files changed

+137
-3
lines changed

2 files changed

+137
-3
lines changed

.github/workflows/automated-release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ on:
120120
description: "Slack channel for notifications"
121121
required: false
122122
type: string
123+
issue-categories:
124+
description: "Jira issue categories to include in the release notes"
125+
required: false
126+
type: string
127+
default: "New Feature,False Positive,False Negative,Bug,Improvement,Task"
123128

124129
outputs:
125130
new-version:
@@ -197,6 +202,8 @@ jobs:
197202
id: get-jira-release-notes
198203
if: inputs.release-notes == ''
199204
uses: SonarSource/release-github-actions/get-jira-release-notes@v1
205+
with:
206+
issue-types: ${{ inputs.issue-categories }}
200207

201208
- name: Summary
202209
if: ${{ inputs.verbose }}

.github/workflows/test-get-jira-release-notes.yml

Lines changed: 130 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
jobs:
1818
unit-tests:
19-
name: Run Unit Tests
19+
name: Run Unit Tests on get-jira-release-notes Module
2020
runs-on: ubuntu-latest
2121

2222
steps:
@@ -39,8 +39,8 @@ jobs:
3939
cd get-jira-release-notes
4040
python -m pytest test_get_jira_release_notes.py -v --cov=get_jira_release_notes --cov-report=term-missing
4141
42-
action-integration-test:
43-
name: Test Action Integration
42+
test-action-inputs:
43+
name: Test Action Input Handling and Environment Variable Outputs
4444
runs-on: ubuntu-latest
4545
steps:
4646
- name: Checkout code
@@ -119,3 +119,130 @@ jobs:
119119
- name: Test action parameter validation
120120
run: |
121121
echo "✅ Action correctly validates required parameters and handles env vars"
122+
123+
test-default-issue-categories:
124+
name: Test Action Integration with Default Issue Categories
125+
runs-on: ubuntu-latest
126+
permissions:
127+
contents: read
128+
id-token: write
129+
steps:
130+
- name: Checkout code
131+
uses: actions/checkout@v4
132+
133+
- name: Get release notes from a sandbox project
134+
id: test-sandbox
135+
uses: ./get-jira-release-notes
136+
with:
137+
jira-project-key: 'SONARPHP'
138+
jira-version-name: '3.49'
139+
use-jira-sandbox: 'true'
140+
141+
- name: Output results
142+
run: |
143+
echo "Jira Release URL: ${{ steps.test-sandbox.outputs.jira-release-url }}"
144+
echo "Release Notes:"
145+
echo "${{ steps.test-sandbox.outputs.release-notes }}"
146+
echo "Jira Release Notes:"
147+
echo "${{ steps.test-sandbox.outputs.jira-release-notes }}"
148+
149+
- name: Verify Jira Release URL
150+
run: |
151+
if [[ "${{ steps.test-sandbox.outputs.jira-release-url }}" != https://sonarsource-sandbox-608.atlassian.net/projects/SONARPHP/versions/*/tab/release-report-all-issues ]]; then
152+
echo "❌ Jira Release URL format is incorrect"
153+
exit 1
154+
else
155+
echo "✅ Jira Release URL format is correct"
156+
fi
157+
158+
- name: Verify Release Notes Content
159+
run: |
160+
if grep -q "### Improvement" <<< "${{ steps.test-sandbox.outputs.release-notes }}"; then
161+
echo "✅ Release Notes contain default issue categories"
162+
else
163+
echo "❌ Release Notes are missing some default issue categories"
164+
exit 1
165+
fi
166+
167+
if grep -q "### Task" <<< "${{ steps.test-sandbox.outputs.release-notes }}"; then
168+
echo "❌ Release Notes should not contain Task category with default settings"
169+
exit 1
170+
else
171+
echo "✅ Release Notes correctly exclude Task category"
172+
fi
173+
174+
- name: Verify Jira Release Notes Content
175+
run: |
176+
if grep -q "h3. Improvement" <<< "${{ steps.test-sandbox.outputs.jira-release-notes }}"; then
177+
echo "✅ Jira Release Notes contain default issue category"
178+
else
179+
echo "❌ Jira Release Notes are missing some default issue categories"
180+
exit 1
181+
fi
182+
183+
if grep -q "h3. Task" <<< "${{ steps.test-sandbox.outputs.jira-release-notes }}"; then
184+
echo "❌ Jira Release Notes should not contain Task category with default settings"
185+
exit 1
186+
else
187+
echo "✅ Jira Release Notes correctly exclude Task category"
188+
fi
189+
190+
test-custom-issue-categories:
191+
name: Test Action Integration with Custom Issue Categories
192+
runs-on: ubuntu-latest
193+
permissions:
194+
contents: read
195+
id-token: write
196+
steps:
197+
- name: Checkout code
198+
uses: actions/checkout@v4
199+
200+
- name: Get release notes from a sandbox project with custom issue types
201+
id: test-sandbox-custom
202+
uses: ./get-jira-release-notes
203+
with:
204+
jira-project-key: 'SONARPHP'
205+
jira-version-name: '3.49'
206+
use-jira-sandbox: 'true'
207+
issue-types: 'Task,Bug,New Feature'
208+
209+
- name: Output results
210+
run: |
211+
echo "Jira Release URL: ${{ steps.test-sandbox-custom.outputs.jira-release-url }}"
212+
echo "Release Notes:"
213+
echo "${{ steps.test-sandbox-custom.outputs.release-notes }}"
214+
echo "Jira Release Notes:"
215+
echo "${{ steps.test-sandbox-custom.outputs.jira-release-notes }}"
216+
217+
- name: Verify Release Notes Content
218+
run: |
219+
if grep -q "### Task" <<< "${{ steps.test-sandbox-custom.outputs.release-notes }}"; then
220+
echo "✅ Release Notes contain Task category as specified"
221+
else
222+
echo "❌ Release Notes are missing Task category"
223+
exit 1
224+
fi
225+
226+
if grep -q "### Improvement" <<< "${{ steps.test-sandbox-custom.outputs.release-notes }}"; then
227+
echo "❌ Release Notes should not contain Improvement category with custom settings"
228+
exit 1
229+
else
230+
echo "✅ Release Notes correctly exclude Improvement category"
231+
fi
232+
233+
- name: Verify Jira Release Notes Content
234+
run: |
235+
if grep -q "h3. Task" <<< "${{ steps.test-sandbox-custom.outputs.jira-release-notes }}"; then
236+
echo "✅ Jira Release Notes contain Task category as specified"
237+
else
238+
echo "❌ Jira Release Notes are missing Task category"
239+
exit 1
240+
fi
241+
242+
if grep -q "h3. Improvement" <<< "${{ steps.test-sandbox-custom.outputs.jira-release-notes }}"; then
243+
echo "❌ Jira Release Notes should not contain Improvement category with custom settings"
244+
exit 1
245+
else
246+
echo "✅ Jira Release Notes correctly exclude Improvement category"
247+
fi
248+

0 commit comments

Comments
 (0)