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

Add changie/changelog/create action #192

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
84 changes: 84 additions & 0 deletions changie/changelog/create/action.yaml
Copy link
Member

Choose a reason for hiding this comment

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

I find this really difficult to follow because it's not really doing much in itself. It's calling a lot of other actions. I understand you're trying to make it easy to read, but in reality it makes it harder to read because to see what it's doing, which isn't that complex, I have to go to 6 different files.

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: "Build changie changelog"
description: "Merge changie entries to build the changelog for ${{ inputs.version }}"


inputs:
version:
description: "The version whose changelogs should be merged"
required: true

outputs:
path:
description: "The path to the new, or existing, changelog for this version"
value: ${{ steps.changelog.outputs.path }}
created:
description: "Identifies if this action created the changelog"
value: ${{ !steps.changelog.outputs.exists }}

runs:
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo "==========INPUTS=========="
echo version : ${{ inputs.version }}

- name: "Get changelog"
id: changelog
uses: ./changie/changelog/view
with:
version: ${{ inputs.version }}

- name: "[INFO] Build changie changelog - SKIPPED"
if: ${{ steps.changelog.outputs.exists }}
shell: bash
run: echo "::notice title=$TITLE::$MESSAGE" && exit 0
env:
TITLE: "[${{ env.NOTIFICATION_PREFIX }}]: Generate changelog - SKIPPED"
MESSAGE: "The changelog already exists for version `${{ inputs.version }}`: `${{ steps.audit.changelog.outputs.path }}`"

- name: "Parse `${{ inputs.version }}`"
id: version
uses: ./parse-semver
with:
version: ${{ inputs.version }}

- name: "Get `core-group` members"
id: core-group
uses: ./github/team/view
with:
team: "core-group"

- name: "Build changelog"
shell: bash
run: ./changie/changelog/create/build_changelog.sh
env:
BASE_VERSION: ${{ steps.version.outputs.base_version }}
PRE_RELEASE: ${{ steps.version.outputs.prerelease }}
IS_PRE_RELEASE: ${{ steps.version.outputs.is_prerelease }}
CORE_TEAM_MEMBERS: ${{ steps.core-group.outputs.members }}

- name: "Remove trailing whitespace and extra newlines"
continue-on-error: true
shell: bash
run: pre-commit run --all-files

- name: "Commit and push changes"
uses: ./github/commit/create
with:
message: "generate changelog for ${{ inputs.version }}"

- name: "[INFO] Build changie changelog"
shell: bash
run: echo "::notice title=$TITLE::$MESSAGE"
env:
TITLE: "[${{ env.NOTIFICATION_PREFIX }}]: Build changie changelog"
MESSAGE: "The changelog has been built for `${{ inputs.version }}`: `${{ steps.changelog.outputs.path }}`"

- name: "[DEBUG] Outputs"
shell: bash
run: |
echo "==========OUTPUTS=========="
echo path : ${{ steps.changelog.outputs.path }}
echo created : ${{ !steps.changelog.outputs.exists }}
17 changes: 17 additions & 0 deletions changie/changelog/create/build_changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# set the core members for changie to skip in annotations
CHANGIE_CORE_TEAM=$CORE_TEAM_MEMBERS

# this is a pre-release
if [[ $IS_PRE_RELEASE -eq 1 ]]; then
changie batch $BASE_VERSION --move-dir '$BASE_VERSION' --prerelease $PRE_RELEASE

# this is a final release with associated pre-releases
elif [[ -d ".changes/$BASE_VERSION" ]]; then
changie batch $BASE_VERSION --include '$BASE_VERSION' --remove-prereleases

# this is a final release with no associated pre-releases
else
changie batch $BASE_VERSION
fi

changie merge