@@ -103,11 +103,11 @@ jobs:
103
103
fi
104
104
105
105
- name : Check if nixpkgs input was changed
106
+ id : changes
106
107
if : github.event_name == 'schedule' || inputs.check_for_changes
107
108
env :
108
109
pr_num : ${{ steps.open_pr_info.outputs.number }}
109
110
pr_url : ${{ steps.open_pr_info.outputs.url }}
110
- changes : ${{ steps.flake_lock.outputs.body || 'No changes' }}
111
111
run : |
112
112
getAttr() {
113
113
nix eval --raw --impure \
@@ -126,36 +126,15 @@ jobs:
126
126
old=$(getNixpkgsRev "github:$repo/$old_branch")
127
127
new=$(getNixpkgsRev "$PWD")
128
128
129
- if [[ "$old" = "$new" ]]; then
130
- (
131
- echo "nixpkgs rev has not changed ($new). Stopping..."
132
- echo 'You can re-run the workflow manually to update anyway.'
133
- ) >&2
134
- (
135
- echo '## Update cancelled'
136
- echo
137
- if [[ -n "$pr_num" ]]; then
138
- echo -n 'The `nixpkgs` input has not changed compared to the already open PR: '
139
- echo "[#$pr_num]($pr_url) (\`nixpkgs.rev: $new\`)."
140
- else
141
- echo -n 'The `nixpkgs` input has not changed compared to the base branch: '
142
- echo "\`$base_branch\`"
143
- fi
144
- echo
145
- echo 'The following changes would have been made:'
146
- echo '```'
147
- echo "$changes"
148
- echo '```'
149
- echo
150
- echo 'You can re-run the workflow manually to update anyway.'
151
- echo
152
- ) >> $GITHUB_STEP_SUMMARY
153
- exit 1
154
- fi
129
+ (
130
+ echo "old_rev=$old"
131
+ echo "new_rev=$new"
132
+ [[ "$old" = "$new" ]] && echo 'cancelled=1'
133
+ ) >> $GITHUB_OUTPUT
155
134
156
135
- name : Update generated files
157
136
id : generate
158
- if : inputs.generate || github.event_name == 'schedule'
137
+ if : (!steps.changes.outputs.cancelled) && ( inputs.generate || github.event_name == 'schedule')
159
138
run : |
160
139
old=$(git show --no-patch --format=%h)
161
140
nix-build ./update-scripts -A generate
@@ -178,6 +157,7 @@ jobs:
178
157
179
158
- name : Create Pull Request
180
159
id : pr
160
+ if : (!steps.changes.outputs.cancelled)
181
161
uses : peter-evans/create-pull-request@v6
182
162
with :
183
163
add-paths : " !**"
@@ -195,7 +175,7 @@ jobs:
195
175
${{ steps.generate.outputs.body || 'No changes' }}
196
176
197
177
- name : Print summary
198
- if : ${{ steps.pr.outputs.pull-request-number }}
178
+ if : steps.pr.outputs.pull-request-number
199
179
run : |
200
180
num="${{ steps.pr.outputs.pull-request-number }}"
201
181
pr_url="${{ steps.pr.outputs.pull-request-url }}"
@@ -214,3 +194,50 @@ jobs:
214
194
echo >> $GITHUB_STEP_SUMMARY
215
195
echo "[#${num}](${pr_url}) was ${operation}." >> $GITHUB_STEP_SUMMARY
216
196
echo >> $GITHUB_STEP_SUMMARY
197
+
198
+ - name : Print cancellation summary
199
+ if : (!steps.pr.outputs.pull-request-number)
200
+ env :
201
+ pr_num : ${{ steps.open_pr_info.outputs.number }}
202
+ pr_url : ${{ steps.open_pr_info.outputs.url }}
203
+ changes : ${{ steps.flake_lock.outputs.body || 'No changes' }}
204
+ cancelled : ${{ steps.changes.outputs.cancelled || '' }}
205
+ rev : ${{ steps.changes.outputs.new_rev || '' }}
206
+ run : |
207
+ if [[ -n "$cancelled" ]]; then
208
+ ( # stdout
209
+ echo "nixpkgs rev has not changed ($rev)."
210
+ echo 'You can re-run the workflow manually to update anyway.'
211
+ ) >&2
212
+ ( # markdown summary
213
+ echo '## Update cancelled'
214
+ echo
215
+ if [[ -n "$pr_num" ]]; then
216
+ echo -n 'The `nixpkgs` input has not changed compared to the already open PR: '
217
+ echo "[#$pr_num]($pr_url) (\`nixpkgs.rev: ${rev:0:6}\`)."
218
+ else
219
+ echo -n 'The `nixpkgs` input has not changed compared to the base branch: '
220
+ echo "\`$base_branch\`"
221
+ fi
222
+ echo
223
+ echo 'You can re-run the workflow manually to update anyway.'
224
+ echo
225
+ ) >> $GITHUB_STEP_SUMMARY
226
+ else
227
+ ( #stdout
228
+ echo "No PR was opened"
229
+ ) >&2
230
+ (
231
+ echo "## Not updated"
232
+ echo
233
+ ) >> $GITHUB_STEP_SUMMARY
234
+ fi
235
+ ( # markdown summary
236
+ echo
237
+ echo 'The following changes would have been made:'
238
+ echo
239
+ echo '```'
240
+ echo "$changes"
241
+ echo '```'
242
+ echo
243
+ ) >> $GITHUB_STEP_SUMMARY
0 commit comments