|
1 | 1 | name: Run pipeline |
2 | 2 |
|
3 | | -on: push |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
4 | 8 |
|
5 | 9 | permissions: |
6 | 10 | contents: write |
7 | 11 |
|
| 12 | +# Make sure we only ever run one per branch so we don't have issues pushing |
| 13 | +# after running the pipeline |
| 14 | +concurrency: |
| 15 | + group: calkit-run-${{ github.ref }} |
| 16 | + cancel-in-progress: false |
| 17 | + |
8 | 18 | jobs: |
9 | 19 | main: |
10 | 20 | name: Run |
11 | 21 | runs-on: ubuntu-latest |
12 | 22 | steps: |
13 | 23 | - uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + # For PRs, checkout the head ref to avoid detached HEAD |
| 26 | + ref: ${{ github.head_ref || github.ref_name }} |
| 27 | + token: ${{ secrets.GITHUB_TOKEN }} |
14 | 28 | - name: Configure Git credentials |
15 | 29 | run: | |
16 | 30 | git config user.name github-actions[bot] |
17 | 31 | git config user.email 41898282+github-actions[bot]@users.noreply.github.com |
| 32 | + - name: Set up Docker Buildx |
| 33 | + uses: docker/setup-buildx-action@v3 |
| 34 | + - name: Setup uv |
| 35 | + uses: astral-sh/setup-uv@v5 |
18 | 36 | - name: Setup Miniforge |
19 | 37 | uses: conda-incubator/setup-miniconda@v3 |
20 | 38 | with: |
21 | 39 | miniforge-version: latest |
22 | 40 | auto-activate-base: true |
23 | 41 | conda-remove-defaults: true |
24 | | - - run: pip install calkit-python |
| 42 | + - name: Install Calkit |
| 43 | + run: uv tool install calkit-python |
25 | 44 | - name: Restore DVC cache |
26 | 45 | id: cache-dvc-restore |
27 | 46 | uses: actions/cache/restore@v4 |
|
33 | 52 | - run: calkit config remote-auth |
34 | 53 | env: |
35 | 54 | CALKIT_DVC_TOKEN: ${{ secrets.CALKIT_DVC_TOKEN }} |
36 | | - - run: dvc pull |
| 55 | + - run: calkit dvc pull |
37 | 56 | - run: calkit run |
| 57 | + # If running on a PR, push to that branch, else push to main |
38 | 58 | - run: calkit save -am "Run pipeline" |
39 | 59 | env: |
40 | 60 | CALKIT_DVC_TOKEN: ${{ secrets.CALKIT_DVC_TOKEN }} |
|
0 commit comments