Skip to content

Commit 922a2b3

Browse files
committed
add environment variable for the CDS api key
1 parent 9a6734c commit 922a2b3

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

.github/workflows/template-pr-ci.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Reusable Pull Request CI tests for modules
22

33
on:
44
workflow_call:
5+
secrets:
6+
CDSAPI_KEY:
7+
required: false
58

69
jobs:
710
build:
@@ -12,22 +15,10 @@ jobs:
1215
matrix:
1316
os: [ubuntu-latest, windows-latest, macos-latest]
1417
python-version: ["3.12"]
18+
env:
19+
CDSAPI_KEY: ${{ secrets.CDSAPI_KEY }}
1520
steps:
1621
- uses: actions/checkout@v4
17-
- name: Conditionally set up .cdsapirc
18-
shell: bash
19-
run: |
20-
if [ -n "${{ secrets.CDSAPI_KEY }}" ]; then
21-
if [[ "$RUNNER_OS" == "Windows" ]]; then
22-
cdsapirc_path="$USERPROFILE/.cdsapirc"
23-
else
24-
cdsapirc_path="$HOME/.cdsapirc"
25-
fi
26-
echo "url = https://cds.climate.copernicus.eu/api" >> "$cdsapirc_path"
27-
echo "key = ${{ secrets.CDSAPI_KEY }}" >> "$cdsapirc_path"
28-
else
29-
echo "CDSAPI_KEY secret is empty or not set. Skipping .cdsapirc setup."
30-
fi
3122
- name: Setup pixi
3223
uses: prefix-dev/setup-pixi@v0.8.3
3324
- name: Run integration tests

0 commit comments

Comments
 (0)