mirror of
https://github.com/fluxcd/flux2.git
synced 2026-02-21 23:21:48 +00:00
feat: add ability to auth to github api
Signed-off-by: Erik Kristensen <erik@erikkristensen.com>
This commit is contained in:
parent
e59889297c
commit
1d82629b34
1 changed files with 9 additions and 1 deletions
|
|
@ -15,6 +15,9 @@ inputs:
|
|||
bindir:
|
||||
description: "Optional location of the Flux binary. Will not use sudo if set. Updates System Path."
|
||||
required: false
|
||||
token:
|
||||
description: "GitHub Token used to authentication against the API (generally only needed to prevent quota limit errors)"
|
||||
required: false
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
|
|
@ -23,9 +26,14 @@ runs:
|
|||
run: |
|
||||
ARCH=${{ inputs.arch }}
|
||||
VERSION=${{ inputs.version }}
|
||||
TOKEN=${{ inputs.token }}
|
||||
|
||||
if [ -n $TOKEN ]; then
|
||||
TOKEN=(-H "Authorization: token $TOKEN")
|
||||
fi
|
||||
|
||||
if [ -z $VERSION ]; then
|
||||
VERSION=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest -sL | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
|
||||
VERSION=$(curl https://api.github.com/repos/fluxcd/flux2/releases/latest -sL "${TOKEN[@]}" | grep tag_name | sed -E 's/.*"([^"]+)".*/\1/' | cut -c 2-)
|
||||
fi
|
||||
|
||||
BIN_URL="https://github.com/fluxcd/flux2/releases/download/v${VERSION}/flux_${VERSION}_linux_${ARCH}.tar.gz"
|
||||
|
|
|
|||
Loading…
Reference in a new issue