Skip to content

Commit 7f09154

Browse files
committed
feat: sort summary list alphabetically
1 parent 8c27cc7 commit 7f09154

File tree

2 files changed

+26
-20
lines changed

2 files changed

+26
-20
lines changed

.changeset/fine-worms-marry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"template-files": patch
3+
---
4+
5+
Sort summary list alphabetically

.github/workflows/sync.yaml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ jobs:
9494
repo: "${{ fromJson(needs.prepare-matrix.outputs.repo-matrix) }}"
9595
if: >
9696
(
97-
needs.changesets.outputs.hasChangesets == 'false' &&
97+
needs.changesets.outputs.hasChangesets == 'false' &&
9898
(
99-
contains(github.event.head_commit.message, 'deploy') ||
99+
contains(github.event.head_commit.message, 'deploy') ||
100100
contains(github.event.head_commit.message, 'release')
101101
)
102-
) ||
102+
) ||
103103
github.event_name == 'workflow_dispatch'
104104
steps:
105105
- name: Generate GitHub App token
@@ -202,16 +202,17 @@ jobs:
202202

203203
- name: Combine summaries and generate final markdown table
204204
run: |
205-
# Create or append to the final summary file
206-
echo "### Summary of Changes" > final_summary.md
207-
echo "" >> final_summary.md
208-
echo "| Repository | PR Link | Files Changed |" >> final_summary.md
209-
echo "|------------|---------|---------------|" >> final_summary.md
205+
# Combine and sort summary tables alphabetically by repo name
206+
find . -name "summary_table.txt" -exec cat {} + | sort -t'|' -k2,2 > sorted_summary.txt
210207
211-
# Loop over the downloaded summary artifacts and append their content
212-
for artifact in $(find . -name "summary_table.txt"); do
213-
cat "$artifact" >> final_summary.md
214-
done
208+
# Write header and sorted content
209+
{
210+
echo "### Summary of Changes"
211+
echo ""
212+
echo "| Repository | PR Link | Files Changed |"
213+
echo "|------------|---------|---------------|"
214+
cat sorted_summary.txt
215+
} > final_summary.md
215216
216217
- name: Upload final summary as artifact
217218
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
@@ -221,14 +222,14 @@ jobs:
221222

222223
- name: Combine discord and generate final markdown list
223224
run: |
224-
# Create or append to the final summary file
225-
echo "### Summary of Changes" > discord_summary.md
226-
echo "" >> discord_summary.md
225+
# Combine and sort Discord summaries alphabetically by repo name
226+
find . -name "discord_list.txt" -exec cat {} + | sort -t'-' -k2,2 > sorted_discord.txt
227227
228-
# Loop over the downloaded summary artifacts and append their content
229-
for artifact in $(find . -name "discord_list.txt"); do
230-
cat "$artifact" >> discord_summary.md
231-
done
228+
{
229+
echo "### Summary of Changes"
230+
echo ""
231+
cat sorted_discord.txt
232+
} > discord_summary.md
232233
233234
- name: Upload final summary as artifact
234235
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
@@ -292,7 +293,7 @@ jobs:
292293
cat final_summary.md
293294
echo "EOF"
294295
} >> $GITHUB_ENV
295-
296+
296297
{
297298
echo "DISCORD_SUMMARY<<EOF"
298299
cat discord_summary.md

0 commit comments

Comments
 (0)