This commit is contained in:
commit
6cf8103742
9 changed files with 276 additions and 0 deletions
60
README.md
Normal file
60
README.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# STACKIT Auth Action
|
||||
|
||||
This Forgejo/GitHub Action installs the [STACKIT CLI](https://github.com/stackitcloud/stackit-cli) and authenticates it using a STACKIT Service Account. It also retrieves a Bearer Token and exports it for use in subsequent steps.
|
||||
|
||||
## Features
|
||||
|
||||
- Installs the STACKIT CLI on Linux-based runners.
|
||||
- Authenticates using a Service Account Key (JSON).
|
||||
- Scopes the access token to a specific Project ID if provided.
|
||||
- Masks the Bearer Token in logs for security.
|
||||
- Exports `STACKIT_BEARER_TOKEN` as an environment variable and an action output.
|
||||
|
||||
## Usage
|
||||
|
||||
Add the following step to your `.forgejo/workflows/` (or `.github/workflows/`) file:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
my-job:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Authenticate with STACKIT
|
||||
uses: stackit-auth-action@v1
|
||||
id: stackit-auth
|
||||
with:
|
||||
service-account-key: ${{ secrets.STACKIT_SERVICE_ACCOUNT_KEY }}
|
||||
project-id: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
|
||||
|
||||
- name: Use STACKIT CLI
|
||||
run: |
|
||||
stackit project list
|
||||
|
||||
- name: Use Bearer Token with curl
|
||||
run: |
|
||||
curl -H "Authorization: Bearer ${{ steps.stackit-auth.outputs.bearer-token }}" \
|
||||
https://api.stackit.cloud/ske/v1/projects/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/clusters
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
| Name | Description | Required | Default |
|
||||
|------|-------------|----------|---------|
|
||||
| `service-account-key` | The JSON content of your STACKIT Service Account Key. | Yes | N/A |
|
||||
| `project-id` | STACKIT Project ID to scope the token. | No | N/A |
|
||||
| `cli-version` | Version of STACKIT CLI to install (without "v" prefix). | No | `0.61.0` |
|
||||
|
||||
## Outputs
|
||||
|
||||
| Name | Description |
|
||||
|------|-------------|
|
||||
| `bearer-token` | The generated STACKIT Bearer Token (masked in logs). |
|
||||
|
||||
## Environment Variables
|
||||
|
||||
This action sets the following environment variable for subsequent steps:
|
||||
- `STACKIT_BEARER_TOKEN`
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Loading…
Add table
Add a link
Reference in a new issue