Skip to content

Commit c762c28

Browse files
committed
Try only one api call?
1 parent bbdc0a3 commit c762c28

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

.github/workflows/main.yml

+14-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,20 @@ on:
99
- '**'
1010
pull_request:
1111
jobs:
12+
get-cmdstan-version:
13+
name: version check
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Get CmdStan version
17+
id: check-cmdstan
18+
# get the latest cmdstan version to use as part of the cache key
19+
run: |
20+
echo "::set-output name=version::$(python -c 'import requests;print(requests.get("https://api.github.com/repos/stan-dev/cmdstan/releases/latest").json()["tag_name"][1:])')"
21+
outputs:
22+
version: ${{ steps.check-cmdstan.outputs.version }}
23+
1224
cmdstanpy:
25+
needs: get-cmdstan-version
1326
name: tests
1427
runs-on: ${{ matrix.os }}
1528
strategy:
@@ -57,18 +70,11 @@ jobs:
5770
- name: Show libraries
5871
run: python -m pip freeze
5972

60-
- name: Get CmdStan version
61-
id: check-cmdstan
62-
# get the latest cmdstan version to use as part of the cache key
63-
run: |
64-
echo "::set-output name=version::$(python -c 'import requests;print(requests.get("https://api.github.com/repos/stan-dev/cmdstan/releases/latest").json()["tag_name"][1:])')"
65-
shell: bash
66-
6773
- name: CmdStan installation cacheing
6874
uses: actions/cache@v2
6975
with:
7076
path: ~/.cmdstan
71-
key: ${{ runner.os }}-cmdstan-${{ steps.check-cmdstan.outputs.version }}-${{ hashFiles('**/install_cmdstan.py') }}
77+
key: ${{ runner.os }}-cmdstan-${{ needs.get-cmdstan-version.outputs.version }}-${{ hashFiles('**/install_cmdstan.py') }}
7278

7379
- name: Install CmdStan (Linux, macOS)
7480
if: matrix.os != 'windows-latest'

0 commit comments

Comments
 (0)