2121 runs-on : ubuntu-latest
2222 strategy :
2323 fail-fast : true
24- matrix :
25- include :
26- - add-paths : .
27- body : apply the changes to this repo.
28- branch : cruft/update
29- commit-message : " Automatic package template update"
30- title : Updates from the package template
31- - add-paths : .cruft.json
32- body : reject these changes for this repo.
33- branch : cruft/reject
34- commit-message : " Reject this package template update"
35- title : Reject new updates from package template
36-
3724 steps :
3825 - uses : actions/checkout@v4
3926
4229 python-version : " 3.11"
4330
4431 - name : Install Cruft
45- run : python -m pip install cruft
32+ run : python -m pip install git+https://github.com/Cadair/ cruft@patch-p1
4633
4734 - name : Check if update is available
4835 continue-on-error : false
@@ -60,25 +47,47 @@ jobs:
6047 echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT"
6148
6249 - name : Run update if available
50+ id : cruft_update
6351 if : steps.check.outputs.has_changes == '1'
6452 run : |
6553 git config --global user.email "${{ github.actor }}@users.noreply.github.com"
6654 git config --global user.name "${{ github.actor }}"
6755
68- cruft update --skip-apply-ask --refresh-private-variables
56+ cruft_output=$(cruft update --skip-apply-ask --refresh-private-variables)
57+ echo $cruft_output
6958 git restore --staged .
7059
71- - name : Create pull request
60+ if [[ "$cruft_output" == *"Failed to cleanly apply the update, there may be merge conflicts."* ]]; then
61+ echo merge_conflicts=1 >> $GITHUB_OUTPUT
62+ else
63+ echo merge_conflicts=0 >> $GITHUB_OUTPUT
64+ fi
65+
66+ - name : Check if only .cruft.json is modified
67+ id : cruft_json
7268 if : steps.check.outputs.has_changes == '1'
73- uses : peter-evans/create-pull-request@v6
69+ run : |
70+ git status --porcelain=1
71+ if [[ "$(git status --porcelain=1)" == " M .cruft.json" ]]; then
72+ echo "Only .cruft.json is modified. Exiting workflow early."
73+ echo "has_changes=0" >> "$GITHUB_OUTPUT"
74+ else
75+ echo "has_changes=1" >> "$GITHUB_OUTPUT"
76+ fi
77+
78+ - name : Create pull request
79+ if : steps.cruft_json.outputs.has_changes == '1'
80+ uses : peter-evans/create-pull-request@v7
7481 with :
7582 token : ${{ secrets.GITHUB_TOKEN }}
76- add-paths : ${{ matrix.add-paths }}
77- commit-message : ${{ matrix.commit-message }}
78- branch : ${{ matrix.branch }}
83+ add-paths : " . "
84+ commit-message : " Automatic package template update "
85+ branch : " cruft/update "
7986 delete-branch : true
80- branch-suffix : timestamp
81- title : ${{ matrix.title }}
87+ draft : ${{ steps.cruft_update.outputs.merge_conflicts == '1' }}
88+ title : " Updates from the package template "
8289 body : |
83- This is an autogenerated PR, which will ${{ matrix.body }}.
84- [Cruft](https://cruft.github.io/cruft/) has detected updates from the Package Template
90+ This is an autogenerated PR, which will applies the latest changes from the [SunPy Package Template](https://github.com/sunpy/package-template).
91+ If this pull request has been opened as a draft there are conflicts which need fixing.
92+
93+ **To run the CI on this pull request you will need to close it and reopen it.**
0 commit comments