Draft-Release Creation Action#86
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new reusable GitHub Actions workflow to create draft GitHub releases with auto-generated notes, alongside a central release-notes template and end-user documentation. This fits the repo’s goal of providing shared workflows for Simulation Systems projects.
Changes:
- Add a reusable workflow (
workflow_call) that checks out a central release template and runsgh release create --generate-notes --draft. - Add a shared
.github/templates/release.ymlto define changelog categories/exclusions. - Add end-user documentation for consuming the workflow, and relax rumdl rules to accommodate the new Markdown patterns.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pyproject.toml |
Disables several rumdl Markdown rules to allow the new README content/style. |
draft-release/README.md |
Documents the new “Draft Release” reusable workflow, usage variants, and changelog label taxonomy. |
.github/workflows/draft-release.yaml |
Implements the reusable workflow that injects a release template and creates a draft release via GitHub CLI. |
.github/templates/release.yml |
Defines release-note categories and excluded labels for GitHub’s release notes generator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…lper script for generating release notes
| fetch-tags: true | ||
| persist-credentials: false | ||
|
|
||
| - name: Checkout shared template repository (sparse) |
There was a problem hiding this comment.
Now redundant. But thanks for the pointer.
| run: | | ||
| set -euo pipefail | ||
|
|
||
| TITLE="Release ${GITHUB_REF_NAME} (Milestone?)" |
There was a problem hiding this comment.
Understood. This is deliberate.
| if [ -n "$PREV_TAG" ]; then | ||
| COMPARE_RANGE="${PREV_TAG}...${GITHUB_SHA}" | ||
| # Single API call to get all commit hashes within the release window | ||
| gh api "repos/${CALLER_REPO}/compare/${COMPARE_RANGE}" --jq '.commits[].sha' >commit-shas.txt | ||
| else | ||
| git -C local-code rev-list --max-count=300 "${GITHUB_SHA}" >commit-shas.txt | ||
| fi |
| # Extract pull requests directly from the repository's main PR list. | ||
| # Pull the 200 most recent merged PRs, then match them against commit-shas.txt | ||
| { | ||
| gh api "repos/${CALLER_REPO}/pulls?state=closed&per_page=100&page=1" | ||
| gh api "repos/${CALLER_REPO}/pulls?state=closed&per_page=100&page=2" | ||
| } | jq -r '.[] | select(.merged_at != null) | | ||
| "\(.merge_commit_sha) \(.number) \(.title) | \(.user.login) | \([.labels[].name] | join(","))"' >recent-prs.txt | ||
|
|
There was a problem hiding this comment.
Deliberately skipping --paginate to avoid rate limit exhaustion, and workflow timeout risk.
| metadata=$(echo "$row" | cut -d'|' -f1) | ||
| user=$(echo "$row" | cut -d'|' -f2 | xargs) | ||
| labels=$(echo "$row" | cut -d'|' -f3 | xargs) | ||
| pr=$(echo "$metadata" | awk '{print $2}') | ||
| title=$(echo "$metadata" | cut -d' ' -f3-) |
There was a problem hiding this comment.
Suggested code changes will break very badly.
… categorised changelog generation - Introduced a composite action for draft releases, consolidating the release process. - Added a new script to compile release notes from a shared changelog template. - Created a structured YAML template for changelog categories and exclusions. - Updated README to reflect new structure and usage instructions. - Removed previously implemented reusable workflow and streamlined the workflow for better maintainability.
| This action is intentionally located at repository root level and has the | ||
| following components: | ||
|
|
||
| - `draft-release/action.yml` (composite action) |
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-slim |
There was a problem hiding this comment.
@github-copilot Not quite. ubuntu-slim is a legitimate, first-party runner image maintained by GitHub in the actions/runner-images repository. See https://github.com/actions/runner-images/blob/main/images/ubuntu-slim/ubuntu-slim-Readme.md
| exclude = [ | ||
| ".github/pull_request_template.md", | ||
| ] | ||
| disable = [ | ||
| "MD033", # Inline HTML | ||
| "MD034", # Bare URL used | ||
| "MD036", # Emphasis used instead of a header | ||
| "MD041", # First line in file should be a top level header | ||
| ] |
| | 🔬 Scientific & Algorithmic Updates | `science`, `technical` | **science**: Domain-specific mathematical changes or model updates.<br>**technical**: Deep algorithmic optimisations or background logic shifts. | | ||
| | 📚 Documentation | `documentation` | Changes isolated to READMEs, inline code docstrings, scientific documentation, working practices, or other non-functional documentation updates. | | ||
| | ⚡ Performance Improvements | `optimisation` | Direct speed execution metrics, runtime improvements, memory, storage, or other resource optimisations. | | ||
| | ♻️ Refactoring | `refactor` | Code cleanup, modularisation, or other internal improvements without behavior changes. | | ||
| | 🛠️ Maintenance | `build`, `chore`, `ci` | **build**: Changes affecting build tools or external compiler toolchains.<br>**chore**: General housekeeping, licence updates, or minor administrative tasks.<br>**ci**: Changes to GitHub Actions workflows, CI/CD pipelines, or other automation.| |
| Step1 -.-> Desc1[Checks out the calling repository into <code>local-code</code><br>with full history and tags] | ||
| Step2 -.-> Desc2[Executes <code>compile-release-notes.sh</code><br>using action-local template <code>release.yml</code>] | ||
| Step4 -.-> Desc3[Executes <code>gh release create/edit</code><br>with categorised changelog notes in draft state] | ||
| Skip -.-> Desc4[Workflow completes early<br>if no merged PRs found in release window] |
There was a problem hiding this comment.
You are digressing Copilot. Those html markers are intentional. GitHub's Markdown rendering, particularly of mermaid diagram has some edge cases, so please don't suggest such changes.
|
Andrew Coughtrie (@andrewcoughtrie) this is ready for your review now. I ended up converting it into a composite action rather than a reusable workflow, so the structure has changed quite a bit. Copilot reviews have been helpful, but not the suggested code changes - we need to be careful. |
PR Summary
Code Reviewer: Andrew Coughtrie (@andrewcoughtrie)
Code Quality Checklist
(Some checks are automatically carried out via the CI pipeline)
AI Assistance and Attribution
Met Office Github Copilot Enterprise was used in compiling the
READMEdocumentation for draft-release workflow.Code Review