Skip to content

Commit 953440d

Browse files
committed
fix/feat(PR_summary): improve messages about renamed and removed files (#25582)
We want to encourange adding module deprecations in a follow-up PR. Hence, - do not warn if such declarations are missing (but add an informational message, asking for a follow-up PR) - do warn if a deprecated_module attribute is present, and suggest a follow-up pull request instead. Co-authored-by: grunweg <[email protected]>
1 parent db52f09 commit 953440d

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/PR_summary.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,32 @@ jobs:
110110
run: |
111111
cd pr-branch
112112
touch moved_without_deprecation.txt
113+
touch extraneous_deprecated_module.txt
113114
git checkout ${{ github.base_ref }}
114115
while IFS= read -r file
115116
do
116117
if grep ^deprecated_module "${file}" ; then
117-
printf 'info: removed file %s contains a deprecation\n' "${file}"
118+
# shellcheck disable=SC2016
119+
printf '\n⚠️ **warning**: removed file `%s` contains a module deprecation: please add this in a follow-up PR instead\n' "${file}" |
120+
tee -a extraneous_deprecated_module.txt
118121
else
119122
# shellcheck disable=SC2016
120-
printf '\n⚠️ **warning**: file `%s` was removed without a module deprecation\n' "${file}" |
123+
printf '\nnote: file `%s` was removed.\nPlease create a follow-up pull request adding a module deprecation. Thanks!\n' "${file}" |
121124
tee -a moved_without_deprecation.txt
122125
fi
123126
done < removed_files.txt
124127
IFS=$'\n'
125128
while IFS= read -r file
126129
do
127-
# shellcheck disable=SC2016
128-
printf '\n⚠️ **warning**: file %s without a module deprecation\n' "${file}" |
129-
tee -a moved_without_deprecation.txt
130+
if grep ^deprecated_module "${file}" ; then
131+
# shellcheck disable=SC2016
132+
printf '\n⚠️ **warning**: renamed file `%s` contains a module deprecation: please add this in a follow-up PR instead\n' "${file}" |
133+
tee -a extraneous_deprecated_module.txt
134+
else
135+
# shellcheck disable=SC2016
136+
printf '\nnote: file `%s` without a module deprecation\nPlease create a follow-up pull request adding one. Thanks!\n' "${file}" |
137+
tee -a moved_without_deprecation.txt
138+
fi
130139
done < renamed_files.txt
131140
132141
# we return to the PR branch, since the next step wants it!
@@ -209,12 +218,18 @@ jobs:
209218
# store in a file, to avoid "long arguments" error.
210219
printf '%s [%s](%s)%s\n\n%s\n\n---\n\n%s\n\n---\n\n%s\n' "${title}" "$(git rev-parse --short HEAD)" "${hashURL}" "${high_percentages}" "${importCount}" "${declDiff}" "${techDebtVar}" > please_merge_master.md
211220
212-
echo "Include any errors about removed or renamed files without deprecation."
221+
echo "Include any errors about removed or renamed files without deprecation,"
222+
echo "as well as errors about extraneous deprecated_module additions."
213223
if [ -s moved_without_deprecation.txt ]
214224
then
215225
printf '\n\n---\n\n' >> please_merge_master.md
216226
cat moved_without_deprecation.txt >> please_merge_master.md
217227
fi
228+
if [ -s extraneous_deprecated_module.txt ]
229+
then
230+
printf '\n\n---\n\n' >> please_merge_master.md
231+
cat extraneous_deprecated_module.txt >> please_merge_master.md
232+
fi
218233
219234
cat please_merge_master.md
220235
../master-branch/scripts/update_PR_comment.sh please_merge_master.md "${title}" "${PR}"

0 commit comments

Comments
 (0)