Skip to content

Commit 86e76b1

Browse files
authored
ci: Fix pytest.yml on pipeline triggered by a pull request from a fork (#1766)
Fixing https://github.com/probabl-ai/skore/actions/runs/15254302350/job/42898127740?pr=1669. `vars` are not passed to workflows that are triggered by a pull request from a fork. This PR fixes this issue, by defining the packages list directly in the workflow. ### Note Environment variables are only available at the steps level, not in the matrix. This is why the matrix uses the output of its need. ### Source ![image](https://github.com/user-attachments/assets/ad86c09f-e7ca-45ff-870c-9a4bc29ac12d) ![image](https://github.com/user-attachments/assets/eb13a9f1-002b-4a3e-acea-eb3748ef89bf)
1 parent de28b3c commit 86e76b1

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

.github/workflows/pytest.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ name: pytest
44
# ================
55
#
66
# The workflow runs `pytest` jobs on all the repository packages, identified by the JSON
7-
# list `vars.PACKAGES` managed in the GitHub interface. If you want to run this workflow
8-
# on a new package, you only have to add its name in the above list.
7+
# list `env.PACKAGES`. If you want to run this workflow on a new package, you only have
8+
# to add its name in the above list.
99
#
1010
# It's important to notice that only one workflow is triggered for all packages.
1111
#
@@ -38,27 +38,33 @@ defaults:
3838
run:
3939
shell: bash
4040

41+
env:
42+
PACKAGES: '["skore","skore-hub-project","skore-local-project"]'
43+
4144
jobs:
4245
pytest-changes:
4346
runs-on: ubuntu-latest
4447
outputs:
48+
packages: ${{ steps.setup.outputs.packages }}
4549
modified-packages: ${{ steps.filter.outputs.changes }}
4650
permissions:
4751
pull-requests: read
4852
steps:
4953
- name: Checkout code
5054
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5155

52-
- name: Create dynamically filtering file, based on `vars.PACKAGES`
56+
- name: Create dynamically filtering file, based on `env.PACKAGES`
57+
id: setup
5358
run: |
59+
echo "packages=${PACKAGES}" >> $GITHUB_OUTPUT
5460
echo "${PACKAGES}" | jq -r '.[]' | while read package; do
5561
>>${FILEPATH} echo "${package}:
5662
- '.github/workflows/pytest.yml'
5763
- 'ci/requirements/${package}/**'
5864
- '${package}/**'"
5965
done
6066
env:
61-
PACKAGES: ${{ vars.PACKAGES }}
67+
PACKAGES: ${{ env.PACKAGES }}
6268
FILEPATH: ${{ runner.temp }}/filters.yaml
6369

6470
- name: Define if at least one file has changed
@@ -122,7 +128,7 @@ jobs:
122128
strategy:
123129
fail-fast: false
124130
matrix:
125-
package: ${{ (github.event_name == 'push') && fromJSON(vars.PACKAGES) || fromJSON(needs.pytest-changes.outputs.modified-packages) }}
131+
package: ${{ (github.event_name == 'push') && fromJSON(needs.pytest-changes.outputs.packages) || fromJSON(needs.pytest-changes.outputs.modified-packages) }}
126132
os: ["ubuntu-latest", "windows-latest"]
127133
python: ["3.9", "3.10", "3.11", "3.12"]
128134
scikit-learn: ["1.4", "1.5", "1.6"]

0 commit comments

Comments
 (0)