-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yaml
More file actions
100 lines (99 loc) · 4.3 KB
/
action.yaml
File metadata and controls
100 lines (99 loc) · 4.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# action.yml
name: "Update SPEC 0 dependencies"
description: "Update the lower bounds of Python dependencies covered by the Scientific Python SPEC 0 support schedule"
author: Scientific Python Developers
inputs:
target_branch:
description: "Target branch for the pull request"
required: true
default: "main"
project_file_name:
description: "Path to the project file listing dependencies, relative to repository root. Defaults to 'pyproject.toml'. Currently only pyproject.toml is supported."
required: true
default: "pyproject.toml"
create_pr:
description: "Whether the action should open a PR or not. Set to false for dry-run/testing."
required: true
default: "true"
commit_msg:
description: "Commit message for the commit to update the versions. by default 'Drop support for unsupported packages conform SPEC 0'. has no effect if `create_pr` is set to false"
required: false
default: "chore: Drop support for unsupported packages conform SPEC 0"
pr_title:
description: "The title of the PR that will be opened. by default 'Drop support for unsupported packages conform SPEC 0'. has no effect if `create_pr` is set to false"
required: false
default: "chore: Drop support for unsupported packages conform SPEC 0"
schedule_path:
description: "Path to the schedule.json file relative to the project root. If not provided, the schedule bundled with the action is used."
required: false
default: ""
token:
description: "GitHub token with pull-requests write permission to create pull requests. Defaults to the built-in GITHUB_TOKEN."
required: false
update_all:
description: "If set, also update all non-SPEC0 dependencies to versions released within the last N years (e.g., 2)."
required: false
default: ""
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Git
shell: bash
run: |
git config user.name "Scientific Python [bot]"
git config user.email "scientific-python@users.noreply.github.com"
- uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
name: Setup Pixi
with:
pixi-version: v0.69.0
manifest-path: ${{ github.action_path }}/pyproject.toml
- name: Fetch schedule from release
if: ${{ inputs.schedule_path == '' }}
uses: robinraju/release-downloader@28fc21f50d76778e7023361aa1f863e717d3d56f # v1.13
with:
repository: "scientific-python/spec0-action"
latest: true
fileName: "schedule.json"
- name: Run update script
shell: bash
run: |
set -e
if [ -n "${{ inputs.schedule_path }}" ]; then
SCHEDULE_PATH="${{ github.workspace }}/${{ inputs.schedule_path }}"
else
SCHEDULE_PATH="${{ github.workspace }}/schedule.json"
fi
echo "Updating ${{ inputs.project_file_name }} using schedule $SCHEDULE_PATH"
UPDATE_ALL_FLAG=""
if [ -n "${{ inputs.update_all }}" ]; then
UPDATE_ALL_FLAG="--update-all ${{ inputs.update_all }}"
fi
pixi run --manifest-path ${{ github.action_path }}/pyproject.toml update-dependencies "${{ github.workspace }}/${{ inputs.project_file_name }}" "$SCHEDULE_PATH" $UPDATE_ALL_FLAG
- name: Changes
id: changes
shell: bash
run: |
echo "Showing changes that would be committed"
git --no-pager diff ${{ inputs.project_file_name }}
if git diff --quiet ${{ inputs.project_file_name }}; then
echo "changes_detected=false" >> "$GITHUB_OUTPUT"
else
echo "changes_detected=true" >> "$GITHUB_OUTPUT"
fi
- name: Create Pull Request
if: ${{ fromJSON(inputs.create_pr) && fromJSON(steps.changes.outputs.changes_detected) }}
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
with:
token: ${{ inputs.token || github.token }}
commit-message: ${{ inputs.commit_msg }}
title: ${{ inputs.pr_title }}
body: "This PR was created automatically"
base: ${{ inputs.target_branch }}
branch: update-spec0-dependencies-${{ github.run_id }}
add-paths: |
${{ inputs.project_file_name }}
branding:
icon: "check-square"
color: "blue"