-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yaml
More file actions
87 lines (84 loc) · 3.69 KB
/
action.yaml
File metadata and controls
87 lines (84 loc) · 3.69 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
# 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 missing, it will be downloaded from the latest release of savente93/SPEC0-schedule"
default: "schedule.json"
token:
description: "GitHub token with repo permissions to create pull requests"
required: true
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- 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@1b2de7f3351f171c8b4dfeb558c639cb58ed4ec0 # v0.9.5
name: Setup Pixi
with:
pixi-version: v0.49.0
manifest-path: ${{ github.action_path }}/pyproject.toml
- name: Fetch Schedule from release
uses: robinraju/release-downloader@daf26c55d821e836577a15f77d86ddc078948b05 # v1.12
with:
repository: "savente93/SPEC0-schedule"
latest: true
fileName: "schedule.json"
- name: Run update script
shell: bash
run: |
set -e
echo "Updating ${{ inputs.project_file_name }} using schedule ${{ inputs.schedule_path }}"
pixi run --manifest-path ${{ github.action_path }}/pyproject.toml update-dependencies "${{ github.workspace }}/${{ inputs.project_file_name }}" "${{ github.workspace }}/${{ inputs.schedule_path }}"
- 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 }}
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"