-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
63 lines (57 loc) · 2.57 KB
/
Copy pathaction.yml
File metadata and controls
63 lines (57 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Setup Mergify CLI
description: Install the Mergify CLI (mergify-cli) prebuilt binary with version pinning.
author: Mergify
branding:
icon: terminal
color: blue
inputs:
mergify_cli_version:
description: |
Version of mergify-cli to install. Use `latest` to install the latest
released version without pinning.
# renovate: datasource=github-releases depName=Mergifyio/mergify-cli versioning=pep440
default: 2026.6.16.1
outputs:
mergify_cli_version:
description: |
The mergify-cli version that was installed. Read back from the installed
binary, so it reflects the real version even when `latest` or an empty
input was requested.
value: ${{ steps.install.outputs.mergify_cli_version }}
runs:
using: composite
steps:
- name: Install mergify-cli
id: install
shell: bash
env:
MERGIFY_CLI_VERSION: ${{ inputs.mergify_cli_version }}
run: |
set -euo pipefail
REPO="Mergifyio/mergify-cli"
die() { echo "::error::$1" >&2; exit 1; }
# For a pinned version, fetch the installer from that release tag (its
# asset naming matches the binary it installs); for `latest`/empty,
# fetch it from `main` and let the installer resolve the latest release.
if [ -z "${MERGIFY_CLI_VERSION}" ] || [ "${MERGIFY_CLI_VERSION}" = "latest" ]; then
ref="main"
else
ref="${MERGIFY_CLI_VERSION}"
fi
bindir="${RUNNER_TEMP}/mergify-cli-bin"
# Install via the CLI's own installer: it owns platform detection, asset
# naming, and SHA256SUMS verification, so we don't duplicate (or have to
# track) any of that. MERGIFY_VERSION forwards the requested version; an
# empty/`latest` value lets the installer resolve the latest release.
# install.sh supports Linux and macOS only.
tmp=$(mktemp -d)
trap 'rm -rf "${tmp}"' EXIT
curl -fsSL "https://raw.githubusercontent.com/${REPO}/${ref}/install.sh" -o "${tmp}/install.sh" \
|| die "failed to fetch install.sh (ref ${ref})"
MERGIFY_VERSION="${MERGIFY_CLI_VERSION}" MERGIFY_INSTALL_DIR="${bindir}" sh "${tmp}/install.sh"
# Expose the binary to later steps and read the version back from it
# (the binary reports its real version) for the action output.
echo "${bindir}" >> "${GITHUB_PATH}"
installed=$("${bindir}/mergify" --version | awk '{print $NF}')
[ -n "${installed}" ] || die "could not read installed mergify-cli version"
echo "mergify_cli_version=${installed}" >> "${GITHUB_OUTPUT}"