Skip to content

Commit c27c153

Browse files
committed
feat: declare secrets explicitly
This is needed to that workflows can pass in secrets explicitly without inherit. Refs: KEH-191
1 parent c2321a9 commit c27c153

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/ci-django-api-README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This reusable workflow is part of the City of Helsinki’s GitHub Actions setup,
1919

2020
## 📚 Usage Instructions
2121

22-
To use this reusable workflow, create a project-specific workflow file in your `.github/workflows` directory. Ensure the `uses` value is set to `City-of-Helsinki/.github/.github/workflows/ci-django-api.yml@main` and `secrets` is set to `inherit`. Also provide the following inputs as needed:
22+
To use this reusable workflow, create a project-specific workflow file in your `.github/workflows` directory. Ensure the `uses` value is set to `City-of-Helsinki/.github/.github/workflows/ci-django-api.yml@main`. Also provide the following inputs and secrets as needed:
2323

2424
### 🛑 Required Inputs
2525

@@ -32,6 +32,10 @@ To use this reusable workflow, create a project-specific workflow file in your `
3232
- **`extra-commands`** (string): Additional setup commands or checks to execute before running tests. Can be used to set environment variables: `echo "EXTRA_TEST_ENV_VAR=test" >> $GITHUB_ENV`.
3333
- **`working-directory`** (string): Repository subdirectory where to run tests. Default is repository root.
3434

35+
### 🔑 Secrets
36+
37+
- **`SONAR_TOKEN`**: Token for SonarQube Cloud Scan. Required.
38+
3539
### 📄 Example usage (`<own project>/.github/workflows/ci.yml`)
3640

3741
```yaml
@@ -47,7 +51,8 @@ on:
4751
jobs:
4852
common:
4953
uses: City-of-Helsinki/.github/.github/workflows/ci-django-api.yml@main
50-
secrets: inherit
54+
secrets:
55+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
5156
with:
5257
python-version: 3.12
5358
postgres-major-version: 17

.github/workflows/ci-django-api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ on:
2626
required: false
2727
type: string
2828
default: '.'
29+
secrets:
30+
SONAR_TOKEN:
31+
description: 'SonarQube Cloud token'
32+
required: true
2933
workflow_dispatch:
3034

3135
env:

0 commit comments

Comments
 (0)