Skip to content

Commit 46301a1

Browse files
GHA-203 Do not use Jira tickets in integration PRs for draft releases (#108)
1 parent c65dfb0 commit 46301a1

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

update-analyzer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This action depends on:
3636
| `secret-name` | Name of the secret for GitHub token to fetch from the vault that has permissions to create pull requests in the target Github repository. | `true` | |
3737
| `plugin-artifacts` | Comma-separated list of plugin artifact names (any `X` in `sonar-X-plugin`) that will be used instead of `plugin-name` when provided. | `false` | |
3838
| `base-branch` | The base branch for the pull request. | `false` | `master` |
39-
| `draft` | A boolean value (`true`/`false`) to control if the pull request is created as a draft. | `false` | `false` |
39+
| `draft` | A boolean value (`true`/`false`) to control if the pull request is created as a draft. When `true`, the commit message is prefixed with `[DO NOT MERGE]` instead of the ticket key. | `false` | `false` |
4040
| `reviewers` | A comma-separated list of GitHub usernames to request a review from (e.g., `user1,user2`). | `false` | |
4141
| `pull-request-body` | The body of the pull request. | `false` | |
4242

update-analyzer/action.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ inputs:
2323
required: false
2424
default: 'master'
2525
draft:
26-
description: 'A boolean value to control if the pull request is created as a draft.'
26+
description: 'A boolean value to control if the pull request is created as a draft. It also implies DO NOT MERGE'
2727
required: false
2828
default: 'false'
2929
reviewers:
@@ -51,18 +51,27 @@ runs:
5151
- name: Set up environment
5252
id: setup_env
5353
shell: bash
54+
env:
55+
TICKET_KEY: ${{ inputs.ticket-key }}
56+
DRAFT: ${{ inputs.draft }}
5457
run: |
55-
if [[ "${{ inputs.ticket-key }}" == SONAR-* ]]; then
58+
if [[ "$TICKET_KEY" == SONAR-* ]]; then
5659
echo "PRODUCT_REPOSITORY=sonar-enterprise" >> $GITHUB_ENV
5760
echo "BUILD_GRADLE_FILE=build.gradle" >> $GITHUB_ENV
58-
elif [[ "${{ inputs.ticket-key }}" == SC-* ]]; then
61+
elif [[ "$TICKET_KEY" == SC-* ]]; then
5962
echo "PRODUCT_REPOSITORY=sonarcloud-core" >> $GITHUB_ENV
6063
echo "BUILD_GRADLE_FILE=private/edition-sonarcloud/build.gradle" >> $GITHUB_ENV
6164
else
6265
echo "::error::Invalid ticket format. Must start with SONAR- or SC-."
6366
exit 1
6467
fi
6568
69+
if [[ "$DRAFT" == "true" ]]; then
70+
echo "commit-prefix=[DO NOT MERGE]" >> $GITHUB_OUTPUT
71+
else
72+
echo "commit-prefix=$TICKET_KEY" >> $GITHUB_OUTPUT
73+
fi
74+
6675
- name: Checkout target repository
6776
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6877
with:
@@ -105,8 +114,8 @@ runs:
105114
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
106115
with:
107116
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
108-
commit-message: '${{ inputs.ticket-key }} Update `${{ inputs.plugin-name }}` plugins to version ${{ inputs.release-version }}'
109-
title: '${{ inputs.ticket-key }} Update `${{ inputs.plugin-name }}` to version ${{ inputs.release-version }}'
117+
commit-message: '${{ steps.setup_env.outputs.commit-prefix }} Update `${{ inputs.plugin-name }}` plugins to version ${{ inputs.release-version }}'
118+
title: '${{ steps.setup_env.outputs.commit-prefix }} Update `${{ inputs.plugin-name }}` to version ${{ inputs.release-version }}'
110119
body: ${{ inputs.pull-request-body }}
111120
base: ${{ inputs.base-branch }}
112121
branch: '${{ inputs.plugin-name }}/update-analyzer-${{ inputs.release-version }}'

0 commit comments

Comments
 (0)