Skip to content

Commit 911f4d1

Browse files
committed
Warn if workflow for automated version increments cannot modify PR
It it's a constant source of confusion that the commit with version increments is not pushed to the PR, in case edits by maintainers are disabled or the PR is created from an organization repository (which makes edits in general impossible). This now adds a warning for that case to at least explain contributors the situation.
1 parent 503a743 commit 911f4d1

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/publishVersionCheckResults.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
- name: Find existing information comment
9696
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
9797
id: search-comment
98-
if: steps.fetch-patch.outputs.pull_request_number
98+
if: always() && steps.fetch-patch.outputs.pull_request_number
9999
with:
100100
body-regex: '^${{ env.COMMENT_FIRST_LINE }}'
101101
issue-number: ${{ steps.fetch-patch.outputs.pull_request_number }}
@@ -113,13 +113,21 @@ jobs:
113113
const fs = require('fs')
114114
const fileList = process.env.FILELIST
115115
if (fileList) { // if list is empty, no versions were changed
116+
const prNumber = '${{ steps.fetch-patch.outputs.pull_request_number }}'
117+
const pr = await github.rest.pulls.get({
118+
pull_number: prNumber,
119+
...context.repo
120+
})
121+
const applyChangeMessagePart = pr.data.maintainer_can_modify
122+
? "An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the _git patch_."
123+
: ":warning: :construction: **This PR cannot be modified by maintainers** because edits are disabled or it is created from an organization repository. To obtain the required changes apply the _git patch_ manually as additional commit."
116124
const commentBody = `
117125
${{ env.COMMENT_FIRST_LINE }}.
118126
Therefore the following files need a version increment:
119127
\`\`\`
120128
${fileList}
121129
\`\`\`
122-
An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the _git patch_.
130+
${applyChangeMessagePart}
123131
<details>
124132
<summary>Git patch</summary>
125133
@@ -130,7 +138,6 @@ jobs:
130138
131139
Further information are available in [Common Build Issues - Missing version increments](https://github.com/eclipse-platform/eclipse.platform.releng.aggregator/wiki/Common-Build-Issues#missing-version-increments).
132140
`.trim()
133-
const prNumber = '${{ steps.fetch-patch.outputs.pull_request_number }}'
134141
const existingCommentId = '${{ steps.search-comment.outputs.comment-id }}'
135142
if (existingCommentId) {
136143
github.rest.issues.updateComment({...context.repo, comment_id: existingCommentId, body: commentBody })

0 commit comments

Comments
 (0)