Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/check-issue-number.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Checks Release Notes in the PR description, runs when:
# opened - PR is opened
# edited - The title/description are changed
# synchronize - New commits appeared.
# We don't use the new content, but we still need to mark this commit Green/Red in GitHub UI

name: Check YouTrack issue number in the description
on:
pull_request:
types: [opened, edited, synchronize]

jobs:
check:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: 'tools/changelog/check-issue-number-github-action'
- uses: ./tools/changelog/check-issue-number-github-action
with:
checkout_ref: ${{ github.ref }}
31 changes: 31 additions & 0 deletions tools/changelog/changelog.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
* kotlin changelog.main.kts action=checkPr prDescription.txt
* ```
*
* ## Checking YouTrack reference in a file
* Not supposed to be called manually, used by GitHub workflow:
* https://github.com/JetBrains/compose-multiplatform/blob/master/tools/changelog/check-issue-number-github-action/action.yml)
* ```
* kotlin changelog.main.kts action=checkIssueNumber prDescription.txt
* ```
*
* compose-multiplatform - name of the GitHub repo
* 5202 - PR number
*
Expand Down Expand Up @@ -85,6 +92,7 @@ println()

when (argsKeyToValue["action"]) {
"checkPr" -> checkPr()
"checkIssueNumber" -> checkIssueNumber()
else -> generateChangelog()
}

Expand Down Expand Up @@ -312,6 +320,29 @@ fun checkPr() {
}
}

fun checkIssueNumber() {
val filePath = argsKeyless.getOrNull(0) ?: error("Please specify a file that contains PR description as the first argument")

val body = File(filePath).readLines()

if (body.any { it == "No related YouTrack issue" }) {
println("Author explicitly acknowledged YouTrack issue is missing")
} else {
val regexes = listOf(
Regex("^Fixes CMP-(\\d*)$"),
Regex("^Fixes https://youtrack.jetbrains.com/issue/CMP-(\\d*)$"),
Regex("^Fixes \\[CMP-(\\d*)\\](https://youtrack.jetbrains.com/issue/CMP-(\\d*))$"),
)
val fixes = body.filter {
regexes.any{ r -> it.matches(r) }
}
if (fixes.isEmpty()) {
println("No YouTrack issue is mentioned in the PR description")
exitProcess(1)
}
}
}

/**
* September 2024
*/
Expand Down
26 changes: 26 additions & 0 deletions tools/changelog/check-issue-number-github-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Reusable GitHub action needed to check YouTrack issue number in the PR description. Used by multiple Compose repositories.

name: Check YouTrack issue number in the description
Copy link
Member

@MatkovIvan MatkovIvan Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that we should have only one task to check the description. Please combine it with the release notes check (as separate steps or so)


inputs:
checkout_ref:
type: string
default: 'master'

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
repository: JetBrains/compose-multiplatform
ref: ${{ inputs.checkout_ref }}
sparse-checkout: 'tools/changelog'
- name: Check YouTrack issue number in the description
shell: bash
env:
# To avoid injections as suggested in https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
PR_DESCRIPTION: ${{ github.event.pull_request.body }}
run: |
cd tools/changelog
echo "$PR_DESCRIPTION" > prDescription.txt
kotlin changelog.main.kts action=checkIssueNumber prDescription.txt token=""
Loading