1
0
mirror of synced 2026-02-13 13:06:56 +00:00

fix: update example to use correct output method

feat: add ability to auth to github api
docs: add authentication snippet example
docs: update checkout@v3, create-pull-request@v4
docs: add documentation about the github token secret

Review: Add suggested change from last week

(per
https://github.com/fluxcd/flux2/pull/3474#discussion_r1067178730)

Signed-off-by: Erik Kristensen <erik@erikkristensen.com>
Signed-off-by: Kingdon Barrett <kingdon@weave.works>
This commit is contained in:
Erik Kristensen
2023-01-21 13:07:23 -05:00
committed by Kingdon Barrett
parent 0439154564
commit 8ff8295d0c
2 changed files with 27 additions and 5 deletions

View File

@@ -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"