Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CZID-8624] Enforce and automate changelog updates #305

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .github/workflows/release_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
description: major, minor, or patch
default: patch
release_notes:
description: A text message summarizing the changes in this release
description: A text message summarizing the changes in this release, only used for branch releases
Copy link
Contributor

Choose a reason for hiding this comment

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

I was a bit confused by this phrasing until you explained it on the team meeting. Maybe expand this a bit to say:
"A text message summarizing the changes in this release. Unused for standard major/minor/patch releases, but used for branch releases."

I'm not sure that's great, but just something clarifying that it doesn't have an expected use in "normal" release flows.


env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/wdl-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,34 @@ jobs:
- id: list_dirs
run: echo "matrix=$(./scripts/diff-workflows.sh |jq -cnR '[inputs|select(length>0)]')" >> $GITHUB_OUTPUT

check-changelog:
runs-on: ubuntu-22.04
needs: list-workflow-dirs
if: ${{ needs['list-workflow-dirs'].outputs.matrix != '[]' && needs['list-workflow-dirs'].outputs.matrix != '' }}
strategy:
matrix:
workflow_dir: ${{fromJson(needs['list-workflow-dirs'].outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- name: Check for Changelog Update
run: |
if git diff --name-only origin/main...HEAD | grep 'CHANGELOG.md' > /dev/null; then
echo "Changelog updated."
else
echo "::error::Changelog not updated!"
exit 1
fi
- name: Check for Changelog Format
run: |
# Count the number of occurrences of the workflow-unreleased string in the changelog
COUNT=$(grep -c "^### ${{ matrix.workflow_dir }}-unreleased" CHANGELOG.md)
if [ "$COUNT" -eq "1" ]; then
echo "Workflow unreleased version only appears once in changelog."
else
echo "::error::Workflow has multiple unreleased versions in changelog"
exit 1
fi

wdl-ci:
runs-on: ubuntu-22.04
needs: list-workflow-dirs
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ To add clarity for users it is [recommended](https://keepachangelog.com/en/1.0.0

In addition, if a modification is made that may affect the results of a pipeline run, we suggest using noting the `[Pipeline Change]` as well as including the specific change that was made, the predicted result to the output.

### Unreleased
When developing add changes to an `-unreleased` entry for your workflow: i.e. `short-read-mngs-unreleased`. Make sure to use the same markdown heading level `###`. If one does not exist, create one, otherwise update the existing.

## Changelog

### short-read-mngs-v7.1.11
- Reduce memory usage of generating the alignment viz
Expand Down
14 changes: 11 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,23 @@ fi
if [[ $WORKFLOW_NAME == amr ]]; then
TAG="amr-v1.3.0"
vincent-czi marked this conversation as resolved.
Show resolved Hide resolved
fi
TAG_MSG=$(mktemp)

if [[ $( git branch --show-current) != "main" ]]; then
COMMIT=$(git rev-parse --short HEAD)
TAG=$TAG"-$COMMIT"
echo "# Changes for ${TAG} ($(date +%Y-%m-%d))" > $TAG_MSG
echo "$RELEASE_NOTES" >> $TAG_MSG
else
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
sed -i "s/^### $WORKFLOW_NAME-unreleased/### $TAG/g" "CHANGELOG.md"
git add "CHANGELOG.md"
git commit -m "Update changelog for version $TAG"
git push origin main
sed -n "/^### $TAG/,/^### /p" "CHANGELOG.md" | sed '1d;$d' >> $TAG_MSG
fi

TAG_MSG=$(mktemp)
echo "# Changes for ${TAG} ($(date +%Y-%m-%d))" > $TAG_MSG
echo "$RELEASE_NOTES" >> $TAG_MSG
git log --pretty=format:%s ${OLD_TAG}..HEAD >> $TAG_MSG || true
if ! git config --get user.name ; then
git config user.name "CZ ID release action triggered by ${GITHUB_ACTOR:-$(whoami)}"
Expand Down
Loading