Skip to content

Commit 780b9e0

Browse files
authored
Merge pull request #703 from RooVetGit/cte/conditionally-disable-integration-tests
Don't run the `integration-test` job if there's no API key
2 parents 60e63a9 + 5c8df59 commit 780b9e0

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

.github/workflows/code-qa.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,25 @@ jobs:
4343
- name: Run unit tests
4444
run: npm test
4545

46+
check-openrouter-api-key:
47+
runs-on: ubuntu-latest
48+
outputs:
49+
exists: ${{ steps.openrouter-api-key-check.outputs.defined }}
50+
steps:
51+
- name: Check if OpenRouter API key exists
52+
id: openrouter-api-key-check
53+
shell: bash
54+
run: |
55+
if [ "${{ secrets.OPENROUTER_API_KEY }}" != '' ]; then
56+
echo "defined=true" >> $GITHUB_OUTPUT;
57+
else
58+
echo "defined=false" >> $GITHUB_OUTPUT;
59+
fi
60+
4661
integration-test:
47-
strategy:
48-
matrix:
49-
os: [ubuntu-latest] # macos-latest, windows-latest
50-
runs-on: ${{ matrix.os }}
62+
runs-on: ubuntu-latest
63+
needs: [check-openrouter-api-key]
64+
if: needs.check-openrouter-api-key.outputs.exists == 'true'
5165
steps:
5266
- name: Checkout code
5367
uses: actions/checkout@v4
@@ -58,11 +72,7 @@ jobs:
5872
cache: 'npm'
5973
- name: Create env.integration file
6074
run: echo "OPENROUTER_API_KEY=${{ secrets.OPENROUTER_API_KEY }}" > .env.integration
61-
- name: Check env.integration file
62-
run: cat .env.integration
6375
- name: Install dependencies
6476
run: npm run install:all
65-
- run: xvfb-run -a npm run test:integration
66-
if: runner.os == 'Linux'
67-
- run: npm run test:integration
68-
if: runner.os != 'Linux'
77+
- name: Run integration tests
78+
run: xvfb-run -a npm run test:integration

0 commit comments

Comments
 (0)