Skip to content
Merged
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
63 changes: 17 additions & 46 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,10 @@ runs:

- name: Set git user
shell: bash
env:
GIT_USER_NAME: ${{ inputs.git_user_name || github.actor }}
GIT_USER_EMAIL: ${{ inputs.git_user_email || format('{0}+{1}@users.noreply.github.com', github.actor_id, github.actor) }}
run: |
# Use provided values or fall back to triggering actor
GIT_USER_NAME='${{ inputs.git_user_name }}'
GIT_USER_EMAIL='${{ inputs.git_user_email }}'

if [[ -z "$GIT_USER_NAME" ]]; then
GIT_USER_NAME="${GITHUB_ACTOR}"
fi
if [[ -z "$GIT_USER_EMAIL" ]]; then
GIT_USER_EMAIL="${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
fi

echo "GIT_COMMITTER_NAME=${GIT_USER_NAME}" >> $GITHUB_ENV
echo "GIT_AUTHOR_NAME=${GIT_USER_NAME}" >> $GITHUB_ENV
echo "EMAIL=${GIT_USER_EMAIL}" >> $GITHUB_ENV
Expand Down Expand Up @@ -194,33 +186,23 @@ runs:
- name: Request publish
id: request-publish
shell: bash
env:
CHANGELOG: ${{ steps.craft.outputs.changelog }}
TARGETS: ${{ steps.craft-targets.outputs.targets }}
RESOLVED_VERSION: ${{ steps.craft.outputs.version }}
RELEASE_BRANCH: ${{ steps.craft.outputs.branch }}
RELEASE_SHA: ${{ steps.craft.outputs.sha }}
RELEASE_PREVIOUS_TAG: ${{ steps.craft.outputs.previous_tag || 'HEAD' }}
SUBDIRECTORY: ${{ inputs.path != '.' && format('/{0}', inputs.path) || '' }}
MERGE_TARGET: ${{ inputs.merge_target || '(default)' }}
PUBLISH_REPO: ${{ inputs.publish_repo || format('{0}/publish', github.repository_owner) }}
run: |
if [[ '${{ inputs.path }}' == '.' ]]; then
subdirectory=''
else
subdirectory='/${{ inputs.path }}'
fi

if [[ -n '${{ inputs.merge_target }}' ]]; then
merge_target='${{ inputs.merge_target }}'
else
merge_target='(default)'
fi

# Use resolved version from Craft output
RESOLVED_VERSION="${{ steps.craft.outputs.version }}"
if [[ -z "$RESOLVED_VERSION" ]]; then
echo "::error::Craft did not output a version. This is unexpected."
exit 1
fi

title="publish: ${GITHUB_REPOSITORY}${subdirectory}@${RESOLVED_VERSION}"

# Determine publish repo
PUBLISH_REPO='${{ inputs.publish_repo }}'
if [[ -z "$PUBLISH_REPO" ]]; then
PUBLISH_REPO="${GITHUB_REPOSITORY_OWNER}/publish"
fi
title="publish: ${GITHUB_REPOSITORY}${SUBDIRECTORY}@${RESOLVED_VERSION}"

# Check if issue already exists
# GitHub only allows search with the "in" operator and this issue search can
Expand All @@ -233,18 +215,7 @@ runs:
exit 0
fi

# Use Craft outputs for git info
RELEASE_BRANCH="${{ steps.craft.outputs.branch }}"
RELEASE_SHA="${{ steps.craft.outputs.sha }}"
PREVIOUS_TAG="${{ steps.craft.outputs.previous_tag }}"

# Fall back to HEAD if no previous tag
if [[ -z "$PREVIOUS_TAG" ]]; then
PREVIOUS_TAG="HEAD"
fi

# Build changelog section if available
CHANGELOG='${{ steps.craft.outputs.changelog }}'
if [[ -n "$CHANGELOG" ]]; then
CHANGELOG_SECTION="
---
Expand All @@ -261,18 +232,18 @@ runs:

body="Requested by: @${GITHUB_ACTOR}

Merge target: ${merge_target}
Merge target: ${MERGE_TARGET}

Quick links:
- [View changes](https://github.com/${GITHUB_REPOSITORY}/compare/${PREVIOUS_TAG}...${RELEASE_BRANCH})
- [View changes](https://github.com/${GITHUB_REPOSITORY}/compare/${RELEASE_PREVIOUS_TAG}...${RELEASE_BRANCH})
- [View check runs](https://github.com/${GITHUB_REPOSITORY}/commit/${RELEASE_SHA}/checks/)

Assign the **accepted** label to this issue to approve the release.
To retract the release, the person requesting it must leave a comment containing \`#retract\` on a line by itself under this issue.

### Targets

${{ steps.craft-targets.outputs.targets }}
${TARGETS}

Checked targets will be skipped (either already published or user-requested skip). Uncheck to retry a target.
${CHANGELOG_SECTION}"
Expand Down
Loading