From ba4be0f7d0325b64e2fbdb5663feec68a383a5fd Mon Sep 17 00:00:00 2001 From: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> Date: Tue, 14 May 2024 16:31:15 +0100 Subject: [PATCH] Add action for towncrier build draft changelog --- towncrier-draft/action.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 towncrier-draft/action.yml diff --git a/towncrier-draft/action.yml b/towncrier-draft/action.yml new file mode 100644 index 0000000..49d2b15 --- /dev/null +++ b/towncrier-draft/action.yml @@ -0,0 +1,29 @@ +name: Towncrier - draft changelog +description: Draft the changelog for the next release. Write the output to the GH Actions job summary. + +runs: + using: composite + steps: + - name: Install Towncrier if needed + shell: bash + run: python3 -m pip install -q towncrier + + - name: Get package version if NodeJS project + id: node + shell: bash + run: | + if [[ -f package.json ]]; then + echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" + fi + + - name: Draft changelog + shell: bash + env: + VER: ${{ steps.node.outputs.version }} + run: | + CMD="towncrier build --draft --date=CCYY-MM-DD" + if [[ -n "$VER" ]]; then + CMD="$CMD --version $VER" + fi + echo -e "# Draft changelog\n" >> "$GITHUB_STEP_SUMMARY" + $CMD | tee -a "$GITHUB_STEP_SUMMARY"