|
| 1 | +# action.yml |
1 | 2 | name: "Update SPEC 0 dependencies" |
2 | 3 | description: "Update the lower bounds of Python dependencies covered by the Scientific Python SPEC 0 support schedule" |
3 | 4 | author: Scientific Python Developers |
| 5 | + |
4 | 6 | inputs: |
5 | 7 | target_branch: |
6 | 8 | description: "Target branch for the pull request" |
@@ -34,63 +36,51 @@ runs: |
34 | 36 | steps: |
35 | 37 | - name: Checkout code |
36 | 38 | uses: actions/checkout@v6 |
37 | | - |
38 | 39 | - name: Set up Git |
39 | 40 | shell: bash |
40 | 41 | run: | |
41 | 42 | git config user.name "Scientific Python [bot]" |
42 | 43 | git config user.email "[email protected]" |
43 | | -
|
44 | 44 | - uses: prefix-dev/[email protected] |
45 | 45 | name: Setup Pixi |
46 | 46 | with: |
47 | 47 | pixi-version: v0.49.0 |
48 | 48 | manifest-path: ${{ github.action_path }}/pyproject.toml |
49 | | - |
50 | | - - name: Regenerate schedule file if necessary |
51 | | - shell: bash |
52 | | - env: |
53 | | - SCHEDULE_FILE: ${{ inputs.schedule_path }} |
54 | | - GH_TOKEN: ${{ inputs.token }} |
55 | | - run: | |
56 | | - set -e |
57 | | - if [ ! -f "${{ github.workspace }}/$SCHEDULE_FILE" ]; then |
58 | | - echo "Regenerating schedule.json..." |
59 | | - pixi run generate-schedule --locked |
60 | | - if diff -q schedule.json "${{ github.workspace }}/$SCHEDULE_FILE" >/dev/null; then |
61 | | - echo "Source and destination have identical contents – nothing to move." |
62 | | - else |
63 | | - mv schedule.json "${{ github.workspace }}/$SCHEDULE_FILE" |
64 | | - fi |
65 | | - else |
66 | | - echo "Schedule file already exists at $SCHEDULE_FILE" |
67 | | - fi |
68 | | -
|
| 49 | + - name: Fetch Schedule from release |
| 50 | + |
| 51 | + with: |
| 52 | + repository: "savente93/SPEC0-schedule" |
| 53 | + latest: true |
| 54 | + fileName: "schedule.json" |
69 | 55 | - name: Run update script |
70 | 56 | shell: bash |
71 | 57 | run: | |
72 | 58 | set -e |
73 | | - echo "Updating ${{inputs.project_file_name}} using schedule ${{inputs.schedule_path}}" |
74 | | - pixi run --manifest-path ${{ github.action_path }}/pyproject.toml update-dependencies "${{ github.workspace }}/${{ inputs.project_file_name }}" "${{ github.workspace }}/${{ inputs.schedule_path }}" |
75 | | -
|
76 | | - - name: Show changes (dry-run) |
77 | | - if: ${{ inputs.create_pr != 'true' }} |
| 59 | + echo "Updating ${{ inputs.project_file_name }} using schedule ${{ inputs.schedule_path }}" |
| 60 | + pixi run --manifest-path ${{ github.action_path }}/pyproject.toml update-dependencies "${{ github.workspace }}/${{ inputs.project_file_name }}" "${{ github.workspace }}/${{ inputs.schedule_path }}" |
| 61 | + - name: Changes |
| 62 | + id: changes |
78 | 63 | shell: bash |
79 | 64 | run: | |
80 | | - echo "Dry run: showing changes that would be committed" |
| 65 | + echo "Showing changes that would be committed" |
81 | 66 | git --no-pager diff ${{ inputs.project_file_name }} |
82 | | -
|
| 67 | + if git diff --quiet ${{ inputs.project_file_name }}; then |
| 68 | + echo "changes_detected=false" >> "$GITHUB_OUTPUT" |
| 69 | + else |
| 70 | + echo "changes_detected=true" >> "$GITHUB_OUTPUT" |
| 71 | + fi |
83 | 72 | - name: Create Pull Request |
84 | | - if: ${{ inputs.create_pr == 'true' }} |
| 73 | + if: ${{ fromJSON(inputs.create_pr) && fromJSON(steps.changes.outputs.changes_detected) }} |
85 | 74 | uses: peter-evans/create-pull-request@v7 |
86 | 75 | with: |
87 | 76 | token: ${{ inputs.token }} |
88 | 77 | commit-message: ${{ inputs.commit_msg }} |
89 | | - path: ${{ inputs.project_file_name }} |
90 | 78 | title: ${{ inputs.pr_title }} |
91 | 79 | body: "This PR was created automatically" |
92 | 80 | base: ${{ inputs.target_branch }} |
93 | 81 | branch: update-spec0-dependencies-${{ github.run_id }} |
| 82 | + add-paths: | |
| 83 | + ${{ inputs.project_file_name }} |
94 | 84 |
|
95 | 85 | branding: |
96 | 86 | icon: "check-square" |
|
0 commit comments