Skip to content

Commit c2fd000

Browse files
GHA-173 Add releasability check to automated release workflow
The releasability check now runs immediately after code freeze and before creating the REL ticket. This prevents unnecessary work if the build is not releasable. Changes: - Add check-releasability job to automated-release.yml - Add check-releasability and with-optional-releasability-checks inputs - Update AUTOMATED_RELEASE.md with new inputs and workflow steps - Update SETUP_AUTOMATED_RELEASE.md with prerequisites and customization - Update CLAUDE.md with Jira project info and documentation guidelines Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2a5ddd6 commit c2fd000

File tree

4 files changed

+90
-11
lines changed

4 files changed

+90
-11
lines changed

.github/workflows/automated-release.yml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ on:
116116
required: false
117117
type: boolean
118118
default: true
119+
check-releasability:
120+
description: "Check the releasability status after freezing the branch"
121+
required: false
122+
type: boolean
123+
default: true
124+
with-optional-releasability-checks:
125+
description: "When checking releasability, also verify that no optional checks have failed"
126+
required: false
127+
type: boolean
128+
default: true
119129
slack-channel:
120130
description: "Slack channel for notifications"
121131
required: false
@@ -170,12 +180,45 @@ jobs:
170180
echo "- Locked branch pattern \`$BRANCH\` to prevent changes during the release." >> $GITHUB_STEP_SUMMARY
171181
echo "- Notifications sent to Slack channel: \`$SLACK_CHANNEL\`." >> $GITHUB_STEP_SUMMARY
172182
183+
# This job verifies that the releasability status on the branch is successful.
184+
# Running this check early prevents unnecessary work (like creating REL tickets) if the release cannot proceed.
185+
check-releasability:
186+
name: Check Releasability
187+
if: ${{ inputs.check-releasability && !cancelled() }}
188+
needs: [ freeze-branch ]
189+
runs-on: ${{ inputs.runner-environment }}
190+
permissions:
191+
statuses: read
192+
steps:
193+
- name: Check Releasability Status
194+
uses: SonarSource/release-github-actions/check-releasability-status@v1
195+
with:
196+
branch: ${{ inputs.branch }}
197+
with-optional-checks: ${{ inputs.with-optional-releasability-checks }}
198+
199+
- name: Summary
200+
if: ${{ inputs.verbose }}
201+
shell: bash
202+
env:
203+
BRANCH: ${{ inputs.branch }}
204+
WITH_OPTIONAL_CHECKS: ${{ inputs.with-optional-releasability-checks == true && 'true' || 'false' }}
205+
run: |
206+
echo "## ✅ Releasability Check" >> $GITHUB_STEP_SUMMARY
207+
echo "" >> $GITHUB_STEP_SUMMARY
208+
echo "### What happened" >> $GITHUB_STEP_SUMMARY
209+
echo "- Verified releasability status on branch \`$BRANCH\`." >> $GITHUB_STEP_SUMMARY
210+
echo "- Optional checks included: \`$WITH_OPTIONAL_CHECKS\`." >> $GITHUB_STEP_SUMMARY
211+
173212
# This step determines the release version, Jira version name, and gathers release notes.
174213
# It sets up the necessary outputs for subsequent steps.
175214
# These outputs include the release version, Jira version name, release notes, Jira release notes, and Jira release URL.
176215
prepare-release:
177216
name: Prepare Release
178-
needs: [ freeze-branch ]
217+
needs: [ freeze-branch, check-releasability ]
218+
if: |
219+
!cancelled() &&
220+
(needs.freeze-branch.result == 'success' || needs.freeze-branch.result == 'skipped') &&
221+
(needs.check-releasability.result == 'success' || needs.check-releasability.result == 'skipped')
179222
runs-on: ${{ inputs.runner-environment }}
180223
permissions:
181224
statuses: read
@@ -563,7 +606,7 @@ jobs:
563606
name: Release Results
564607
runs-on: ${{ inputs.runner-environment }}
565608
if: always()
566-
needs: [ prepare-release, publish-github-release, create-release-ticket, release-in-jira, create-integration-tickets, update-analyzers ]
609+
needs: [ check-releasability, prepare-release, publish-github-release, create-release-ticket, release-in-jira, create-integration-tickets, update-analyzers ]
567610
env:
568611
RELEASE_PROCESS: ${{ inputs.release-process != '' && inputs.release-process || 'https://xtranet-sonarsource.atlassian.net/wiki/spaces/CSD/pages/4325048388/Release+Instructions+-+Cloud+Security' }}
569612
steps:
@@ -580,7 +623,7 @@ jobs:
580623
SQS_PR_URL: ${{ needs.update-analyzers.outputs.sqs-pull-request-url || 'not created' }}
581624
SQC_PR_URL: ${{ needs.update-analyzers.outputs.sqc-pull-request-url || 'not created' }}
582625
run: |
583-
ALL_SUCCESS=$(echo '${{ toJson(needs) }}' | jq -r 'to_entries | all(.value.result == "success")')
626+
ALL_SUCCESS=$(echo '${{ toJson(needs) }}' | jq -r 'to_entries | all(.value.result == "success" or .value.result == "skipped")')
584627
585628
if [[ "$ALL_SUCCESS" == "true" ]]; then
586629
echo "# 🎉 Release Successful" >> $GITHUB_STEP_SUMMARY

CLAUDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
This is a collection of reusable GitHub Actions for automating SonarSource analyzer releases. Actions handle Jira integration (tickets, versions, release notes), GitHub releases, cross-repository updates, and Slack notifications.
88

9+
## Jira Project
10+
11+
Related Jira tickets for this project are tracked in the **GHA** (GitHub Automation) project. When available, use the Jira MCP to access ticket details (e.g., `GHA-123`).
12+
913
## Branching
1014

1115
**Important:** Changes must always be made on a feature branch, never directly on `master`.
@@ -14,6 +18,14 @@ This is a collection of reusable GitHub Actions for automating SonarSource analy
1418
- Adapt `<feature-name>` based on the task/prompt (use lowercase, hyphen-separated)
1519
- If already on a feature branch, do not create a new branch—continue working on the current branch
1620

21+
## Documentation
22+
23+
**Important:** When making any code changes, check if the related README or documentation needs to be updated. Each action has its own `README.md`, and workflow documentation is in `docs/`. Keep documentation in sync with code changes.
24+
25+
When creating a new action:
26+
- Add a `README.md` to the action's directory documenting inputs, outputs, and usage
27+
- Update the main `README.md` at the repository root to link to the new action
28+
1729
## Testing
1830

1931
**Important:** When making any code changes, always check if there are related tests that need to be updated. Always run the tests after making changes to ensure nothing is broken.

docs/AUTOMATED_RELEASE.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@ This reusable GitHub Actions workflow automates the end-to-end release process a
77
The workflow orchestrates these steps:
88

99
1. Optionally freeze (lock) the target branch at the start of the release
10-
2. Determine the release version and Jira version name
11-
3. Optionally generate Jira release notes if not provided
12-
4. Create a Jira release ticket
13-
5. Publish a GitHub release (draft or final)
14-
6. Release the current Jira version and create the next version in Jira
15-
7. Optionally create integration tickets (SLVS, SLVSCODE, SLE, SLI, SQC, SQS)
16-
8. Optionally open analyzer update PRs in SQS and SQC
17-
9. Optionally post per-job and final workflow summaries when `verbose` is enabled
10+
2. Check releasability status on the branch (enabled by default)
11+
3. Determine the release version and Jira version name
12+
4. Optionally generate Jira release notes if not provided
13+
5. Create a Jira release ticket
14+
6. Publish a GitHub release (draft or final)
15+
7. Release the current Jira version and create the next version in Jira
16+
8. Optionally create integration tickets (SLVS, SLVSCODE, SLE, SLI, SQC, SQS)
17+
9. Optionally open analyzer update PRs in SQS and SQC
18+
10. Optionally post per-job and final workflow summaries when `verbose` is enabled
1819

1920
## Dependencies
2021

2122
This workflow composes several actions from this repository:
2223

24+
- `SonarSource/release-github-actions/check-releasability-status`
2325
- `SonarSource/release-github-actions/get-release-version`
2426
- `SonarSource/release-github-actions/get-jira-version`
2527
- `SonarSource/release-github-actions/get-jira-release-notes`
@@ -60,6 +62,8 @@ This workflow composes several actions from this repository:
6062
| `release-process` | Release process documentation URL | No | General page |
6163
| `verbose` | When `true`, posts per-job summaries and a final run summary | No | `false` |
6264
| `freeze-branch` | When `true`, locks the target branch during the release and unlocks it after publishing | No | `true` |
65+
| `check-releasability` | When `true`, verifies the releasability status on the branch before proceeding | No | `true` |
66+
| `with-optional-releasability-checks` | When checking releasability, also verify that no optional checks have failed | No | `true` |
6367
| `slack-channel` | Slack channel to notify when locking/unlocking the branch | No | - |
6468

6569
## Outputs
@@ -121,6 +125,10 @@ jobs:
121125
122126
## Notes
123127
128+
- When `check-releasability: true` (default), the workflow will:
129+
- Check the releasability status on the specified branch immediately after freezing
130+
- Fail early if the releasability check does not pass, preventing unnecessary work (like creating REL tickets)
131+
- Optionally check for failed optional checks when `with-optional-releasability-checks: true`
124132
- When `freeze-branch: true`, the workflow will:
125133
- Lock the specified branch at the start of the release
126134
- Proceed with the release steps

docs/SETUP_AUTOMATED_RELEASE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ For detailed workflow documentation (inputs, outputs, behavior), see [AUTOMATED_
88

99
Before the workflow will work, complete these steps:
1010

11+
### Releasability Status
12+
13+
- [ ] **Ensure releasability checks are configured** for your repository. The workflow verifies releasability status on the branch before proceeding with the release. This prevents creating REL tickets and other artifacts if the build is not releasable.
14+
1115
### Jira Configuration
1216

1317
- [ ] **Add `Jira Tech User GitHub` as Administrator** on your Jira project (required to create/release versions)
@@ -296,3 +300,15 @@ Specify a different runner:
296300
```yaml
297301
runner-environment: "sonar-s"
298302
```
303+
304+
### Releasability Check
305+
306+
The workflow checks releasability status by default. To disable or customize:
307+
```yaml
308+
# Disable releasability check entirely
309+
check-releasability: false
310+
311+
# Check releasability but allow failed optional checks
312+
check-releasability: true
313+
with-optional-releasability-checks: false
314+
```

0 commit comments

Comments
 (0)