Skip to content

Add draft-release composite action - #87

Open
Yaswant Pradhan (yaswant) wants to merge 2 commits into
mainfrom
feature/draft-release
Open

Yaswant Pradhan (yaswant) wants to merge 2 commits into
mainfrom
feature/draft-release

Conversation

@yaswant

@yaswant Yaswant Pradhan (yaswant) commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

PR Summary

Add draft release composite action tailored for the Simulation Systems

Code Reviewer: Andrew Coughtrie (@andrewcoughtrie)

✅ Code Quality Checklist

(Some checks are automatically carried out via the CI pipeline)

  • I have performed a self-review of my own code
  • My code follows the project's style guidelines
  • The modified workflow's README has been updated, if required
  • The changes have been sufficiently tested (please describe)

🤖 AI Assistance and Attribution

  • Some of the content of this change has been produced with the assistance of Generative AI tool name (e.g., Met Office GitHub Copilot Enterprise, GitHub Copilot Personal, ChatGPT GPT-4, etc) and I have followed the Simulation Systems AI policy (including attribution labels)

💻 Code Review

  • The changes are appropriate and testing has been sufficient

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a reusable draft-release composite GitHub Action to generate categorised draft release notes (using a shared changelog template) and create/update a draft GitHub Release for the current tag.

Changes:

  • Adds a composite action (draft-release/action.yaml) that checks out the caller repo, compiles release notes, and drafts/updates a GitHub Release.
  • Adds a release-changelog category template (draft-release/templates/release.yml) plus documentation (draft-release/README.md).
  • Updates Markdown lint configuration in pyproject.toml to allow Markdown constructs used by the new README.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pyproject.toml Adjusts rumdl rule disables to accommodate new Markdown content.
draft-release/templates/release.yml Defines changelog categories and excluded labels for release note generation.
draft-release/README.md Documents the draft-release action, categories, usage, permissions, and outputs.
draft-release/bin/compile-release-notes.sh Implements release note compilation from tags/commits and merged PR metadata.
draft-release/action.yaml Defines the composite action steps to compile notes and create/edit draft releases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread draft-release/action.yaml
Comment on lines +7 to +10
name: Shared Global Release Engine
description: Automates draft releases using centralised assets

runs:
Comment thread draft-release/README.md
Comment on lines +118 to +121
The compile step exposes:

- `has_commits`: `true` when release notes were generated from commits,
otherwise `false`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Would the plan be for this to trigger on creation of a tag on the repo? or by some other mechanism? If so, what conditions of tag creation would trigger this?

Otherwise looks like a good change overall, a couple of suggestions requests but otherwise I'm happy. Can't really test it and I think we should probably do so quite thoroughly on the git_playgound repo before deploying to LFRic Apps etc.

"\(.merge_commit_sha) \(.number) \(.title) | \(.user.login) | \([.labels[].name] | join(",")) | \(.author_association)"' >recent-prs.txt

# Filter recent-prs down to ONLY those matching a commit SHA from our release range
awk 'NR==FNR { shas[tolower($1)]=1; next } (tolower($1) in shas) { print }' commit-shas.txt recent-prs.txt >pr-data.txt

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should probably check that we aren't missing any PRs, it looks like we would only get the last 200 we are probably safe at the moment but one day 200+ PRs in a release might happen and we want to catch that, checking that first commit after the previous release has been caught in the PR list would be useful and atm probably just failing with a safe message would be fine.

Comment on lines +114 to +158
while IFS= read -r raw_line; do
line="${raw_line%%#*}"
trimmed="${line#"${line%%[![:space:]]*}"}"
trimmed="${trimmed%"${trimmed##*[![:space:]]}"}"
[ -z "$trimmed" ] && continue

case "$trimmed" in
changelog:) continue ;;
categories: | exclude:)
mode="${trimmed%?}"
in_category_labels=0
continue
;;
labels:)
case "$mode" in
categories) [ "$current_index" -ge 0 ] && in_category_labels=1 ;;
exclude) in_category_labels=2 ;;
esac
continue
;;
esac

if [ "$mode" = "categories" ] && [[ "$trimmed" =~ ^-[[:space:]]title:[[:space:]]*\"(.*)\"$ ]]; then
CATEGORY_TITLES+=("${BASH_REMATCH[1]}")
CATEGORY_LABELS+=("")
current_index=$((current_index + 1))
in_category_labels=0
continue
fi

if [ "$in_category_labels" -eq 1 ] && [[ "$trimmed" =~ ^-[[:space:]]+\"?([A-Za-z0-9._-]+)\"?\;?$ ]]; then
lbl="${BASH_REMATCH[1],,}"
if [ -z "${CATEGORY_LABELS[$current_index]}" ]; then
CATEGORY_LABELS[current_index]="$lbl"
else
CATEGORY_LABELS[current_index]+="|$lbl"
fi
continue
fi

if [ "$in_category_labels" -eq 2 ] && [[ "$trimmed" =~ ^-[[:space:]]+\"?([A-Za-z0-9._-]+)\"?\;?$ ]]; then
EXCLUDE_LABELS+=("${BASH_REMATCH[1],,}")
continue
fi
done <"$TEMPLATE_FILE"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we have a few more comments here please to describe what the code is doing (Copilot will probably do a good job of adding them), it's very hard to read regex's.


# (build) Changes affecting build tools or external compiler toolchains.
# (chore) General housekeeping, license updates, or minor administrative tasks.
# (ci) Changes to GitHub Actions workflows, CI/CD pipelines, or other automation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Include suites here?

Suggested change
# (ci) Changes to GitHub Actions workflows, CI/CD pipelines, or other automation.
# (ci) Changes to GitHub Actions workflows, CI/CD pipelines, suites, or other automation.

Comment on lines +24 to +26
- title: "⚠️ Deprecations"
labels:
- "deprecated"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we need a similar label for removal of functionality?

Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Release ranges and PR queries can omit entries, exclusions can leak contributor details, and the documented output is not exposed.

3 open findings

🧠 Review effort: Balanced

Comment thread draft-release/README.md
Comment on lines +67 to +69
classDef trigger style fill:#f9f,stroke:#333,stroke-width:2px,font-weight:bold;
classDef step style fill:#bbf,stroke:#333,stroke-width:1px;
classDef desc style fill:#fff,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5,font-size:12px;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a release drafter action

3 participants