-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
33 lines (30 loc) · 911 Bytes
/
action.yml
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
# Copyright (c) 2022 OpenFaaS Ltd
name: 'openfaas-oidc'
description: 'Log into the OpenFaaS OIDC proxy for actuated using GitHub Actions.'
branding:
icon: 'arrow-right-circle'
color: 'gray-dark'
inputs:
gateway:
description: 'URL for the OpenFaaS gateway.'
required: true
default: ""
runs:
using: 'composite'
steps:
- name: Update faas-cli auth
env:
GATEWAY: ${{ inputs.gateway }}
shell: bash
id: setup-config
run: |
OIDC_TOKEN=$(curl -sLS "${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=$GATEWAY" -H "User-Agent: actions/oidc-client" -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN")
JWT=$(echo $OIDC_TOKEN | jq -j '.value')
mkdir -p .openfaas
cat > .openfaas/config.yml <<EOF
auths:
- gateway: $GATEWAY
auth: oauth2
token: $JWT
EOF
chmod 0700 -R .openfaas