From 4800fc0221f114d81ea6f92433d1e37ef7a91d89 Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Thu, 9 Nov 2023 17:15:59 -0500 Subject: [PATCH 1/5] enforce changelog --- .github/workflows/release_workflows.yml | 2 +- .github/workflows/wdl-ci.yml | 28 +++++++++++++++++++++++++ CHANGELOG.md | 2 +- scripts/release.sh | 17 ++++++++++++--- 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release_workflows.yml b/.github/workflows/release_workflows.yml index 3c345b828..4da3d4c29 100644 --- a/.github/workflows/release_workflows.yml +++ b/.github/workflows/release_workflows.yml @@ -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 env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/wdl-ci.yml b/.github/workflows/wdl-ci.yml index c864bc5d8..e888a0810 100644 --- a/.github/workflows/wdl-ci.yml +++ b/.github/workflows/wdl-ci.yml @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index cac266354..c71f9b299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ 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 +## Changelog ### short-read-mngs-v7.1.11 - Reduce memory usage of generating the alignment viz diff --git a/scripts/release.sh b/scripts/release.sh index 0c7ca5e3f..3da10e262 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -28,19 +28,30 @@ else exit 1 fi +<<<<<<< Updated upstream # Fix until we can update this script to follow semantic versioning if [[ $WORKFLOW_NAME == amr ]]; then TAG="amr-v1.3.0" fi +======= +TAG_MSG=$(mktemp) +>>>>>>> Stashed changes 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 "action@github.com" + git config --local user.name "GitHub Action" + sed -i "s/^### \$WORKFLOW_NAME-unreleased/^### \$TAG/g" CHANGELOG.md + git add $CHANGELOG_FILE + git commit -m "Update changelog for version $TAG" + git push origin main + awk "/^### $TAG/,/^### /{if (!/^### $TAG/ && !/^### /) print}" "$FILE_PATH" >> $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)}" From e238e8d151da19f15edad666a71d448cc9787153 Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Thu, 9 Nov 2023 17:16:56 -0500 Subject: [PATCH 2/5] conflict --- scripts/release.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 3da10e262..0c160bf12 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -28,14 +28,11 @@ else exit 1 fi -<<<<<<< Updated upstream # Fix until we can update this script to follow semantic versioning if [[ $WORKFLOW_NAME == amr ]]; then TAG="amr-v1.3.0" fi -======= TAG_MSG=$(mktemp) ->>>>>>> Stashed changes if [[ $( git branch --show-current) != "main" ]]; then COMMIT=$(git rev-parse --short HEAD) From 4759a0945d55f819ebfdc3662b14ca5b45efd565 Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Thu, 9 Nov 2023 17:47:17 -0500 Subject: [PATCH 3/5] fix release message --- scripts/release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index 0c160bf12..2e700be3b 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -43,10 +43,10 @@ else git config --local user.email "action@github.com" git config --local user.name "GitHub Action" sed -i "s/^### \$WORKFLOW_NAME-unreleased/^### \$TAG/g" CHANGELOG.md - git add $CHANGELOG_FILE + git add "CHANGELOG.md" git commit -m "Update changelog for version $TAG" git push origin main - awk "/^### $TAG/,/^### /{if (!/^### $TAG/ && !/^### /) print}" "$FILE_PATH" >> $TAG_MSG + sed -n "/^### $TAG/,/^### /p" "CHANGELOG.md" | sed '1d;$d' >> $TAG_MSG fi git log --pretty=format:%s ${OLD_TAG}..HEAD >> $TAG_MSG || true From a61e1c0e8c2ff586ce9df789f680093bbeff3a03 Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Thu, 9 Nov 2023 17:59:25 -0500 Subject: [PATCH 4/5] tested script --- scripts/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.sh b/scripts/release.sh index 2e700be3b..2bc1e304c 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -42,7 +42,7 @@ if [[ $( git branch --show-current) != "main" ]]; then else git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - sed -i "s/^### \$WORKFLOW_NAME-unreleased/^### \$TAG/g" CHANGELOG.md + 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 From 591e12116a7543ddebceff024add9fe32d1dbb82 Mon Sep 17 00:00:00 2001 From: Todd Morse Date: Thu, 9 Nov 2023 18:02:34 -0500 Subject: [PATCH 5/5] docs --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c71f9b299..ba123e95c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ 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. +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