File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed
Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ # Copyright lowRISC contributors (OpenTitan project).
2+ # Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+ # SPDX-License-Identifier: Apache-2.0
4+
5+ # NOTE.
6+ # Requires id-token: write in the workflow to get the JWT
7+
8+ name : Get lowrisc-ci app access token
9+ description : Obtain a lowrisc-ci GitHub App installation access token from the lowRISC CA
10+
11+ inputs :
12+ audience :
13+ description : intended audience for the requested JWT
14+ type : string
15+ default : " https://ca.lowrisc.org"
16+ ca_api_endpoint :
17+ description : lowRISC CA endpoint from which to try and obtain a token.
18+ type : string
19+ default : " https://ca.lowrisc.org/api/github/repos/${{ github.repository }}/token"
20+
21+ runs :
22+ using : " composite"
23+ steps :
24+ - name : Get and exchange tokens
25+ id : get_token
26+ run : |
27+ # First, manually request a JSON Web Token (JWT) from GitHub's OIDC provider for the workflow
28+ # - Set our CA as the intended audience
29+ ID_TOKEN=$(curl -sSf -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=${{ inputs.audience }}" | jq -r .value)
30+ echo "::add-mask::$ID_TOKEN"
31+ # Now use the JWT token to request the lowRISC CA to provide an lowrisc-ci app installation access token suitable for our action
32+ ACCESS_TOKEN=$(curl -sSf -X POST -H "Authorization: Bearer $ID_TOKEN" ${{ inputs.ca_api_endpoint }})
33+ echo "::add-mask::$ACCESS_TOKEN
34+ echo "token=$ACCESS_TOKEN" >> "$GITHUB_OUTPUT"
35+
36+ outputs :
37+ token :
38+ description : " Token"
39+ value : ${{ steps.get_token.outputs.token }}
40+
You can’t perform that action at this time.
0 commit comments