name: verctl version PR
description: >-
Open or update the Version PR. Requires `verctl` on PATH.
author: victor-software-house
branding:
icon: git-pull-request
color: gray-dark
inputs:
token:
description: Token that can open PRs. Default GITHUB_TOKEN.
required: false
default: ${{ github.token }}
config:
description: Path to the declarations file.
required: false
default: .ctl/ver.yaml
title:
description: Version PR title.
required: false
default: "chore(release): version packages"
commit-message:
description: Commit message on the Version PR.
required: false
default: "chore(release): version packages"
dry-run:
description: Preview only. Set to `true` to write nothing.
required: false
default: "false"
auto-merge:
description: >-
Set to `true` to enable GitHub auto-merge on the Version PR, as a squash
titled after the PR. Requires a ruleset with a required status check on
the base branch; without one the action fails, because GitHub would merge
at once. Classic branch protection is not read: its API needs
administration access that the token does not have.
Requires `token` other than GITHUB_TOKEN, such as a GitHub App token: a
merge made with GITHUB_TOKEN starts no workflow, so publish would not run.
required: false
default: "false"
runs:
using: composite
steps:
- name: Refuse auto-merge with GITHUB_TOKEN
if: inputs.auto-merge == 'true' && inputs.dry-run != 'true' && inputs.token == github.token
shell: bash
run: |
echo "::error::auto-merge needs a token other than GITHUB_TOKEN; a merge made with GITHUB_TOKEN starts no publish workflow"
exit 1
- name: Prepare release
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
VERCTL_CONFIG: ${{ inputs.config }}
VERCTL_DRY_RUN: ${{ inputs.dry-run }}
VERCTL_PR_TITLE: ${{ inputs.title }}
VERCTL_COMMIT_MESSAGE: ${{ inputs.commit-message }}
run: |
set -euo pipefail
extra=()
if [ "${VERCTL_DRY_RUN}" = true ]; then
extra+=(--dry-run)
fi
exec verctl prepare --pr -c "${VERCTL_CONFIG}" "${extra[@]}"
- name: Enable auto-merge
if: inputs.auto-merge == 'true' && inputs.dry-run != 'true'
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
REPO: ${{ github.repository }}
BASE: ${{ github.event.repository.default_branch }}
run: ${{ github.action_path }}/auto-merge.sh