Skip to content

Commit 72feeba

Browse files
Update workflow sync-element-web.yml
- Allow dry-runs to test the script without creating issues - Disable mentions and links so they don't send notifications to creators
1 parent 38c87f0 commit 72feeba

1 file changed

Lines changed: 28 additions & 7 deletions

File tree

.github/workflows/sync-element-web.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ name: Sync Element Web
22

33
on:
44
schedule:
5-
- cron: "0 3 * * 1,4" # every Monday and Thursday at 03:00 UTC
5+
- cron: "0 3 * * 1,4"
66
workflow_dispatch:
7+
inputs:
8+
dry_run:
9+
description: 'Skip creating the issue and upload the sanitized changelog as an artifact'
10+
type: boolean
11+
default: true
712

813
jobs:
914
sync:
@@ -53,7 +58,7 @@ jobs:
5358
./scripts/rename.sh ./upstream-release ./processed
5459
5560
- name: Commit and push
56-
if: steps.release.outputs.skip != 'true'
61+
if: steps.release.outputs.skip != 'true' && (github.event_name != 'workflow_dispatch' || inputs.dry_run != true)
5762
run: |
5863
git config user.name "github-actions"
5964
git config user.email "actions@github.com"
@@ -74,6 +79,13 @@ jobs:
7479
echo "No changes to commit"
7580
fi
7681
82+
- name: Show changes (dry-run only)
83+
if: steps.release.outputs.skip != 'true' && github.event_name == 'workflow_dispatch' && inputs.dry_run == true
84+
run: |
85+
echo "=== Dry-run mode: showing changed file names ==="
86+
git diff --stat
87+
echo ""
88+
7789
- name: Prepare changelog for issue
7890
if: steps.release.outputs.skip != 'true'
7991
run: |
@@ -82,15 +94,24 @@ jobs:
8294
| jq -r '.body' > ./changelog-excerpt.md
8395
echo "Release notes fetched from GitHub"
8496
85-
# Neutralize @-mentions (insert zero-width space after '@')
86-
perl -CS -pe 's/@/@\x{200B}/g' ./changelog-excerpt.md > ./changelog-excerpt.sanitized.md
87-
mv ./changelog-excerpt.sanitized.md ./changelog-excerpt.md
97+
# Disable @-mentions (insert zero-width space after '@')
98+
perl -CS -i -pe 's/@/@\x{200B}/g' ./changelog-excerpt.md
99+
# Disable owner/repo#123 style references (insert zero-width space before '#')
100+
perl -CS -i -pe 's/([A-Za-z0-9_.\-]+\/[A-Za-z0-9_.\-]+)#(\d+)/$1\x{200B}#$2/g' ./changelog-excerpt.md
101+
# Disable full GitHub issue/PR URLs (insert zero-width space before number)
102+
perl -CS -i -pe 's!(https://github\.com/[A-Za-z0-9_.\-]+/[A-Za-z0-9_.\-]+/(?:issues|pull))/(\d+)!$1/\x{200B}$2!g' ./changelog-excerpt.md
103+
104+
- name: Upload sanitized changelog (dry-run only)
105+
if: steps.release.outputs.skip != 'true' && github.event_name == 'workflow_dispatch' && inputs.dry_run == true
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: changelog-preview
109+
path: ./changelog-excerpt.md
88110

89111
- name: Notify via GitHub issue
90-
if: steps.release.outputs.skip != 'true'
112+
if: steps.release.outputs.skip != 'true' && (github.event_name != 'workflow_dispatch' || inputs.dry_run != true)
91113
uses: peter-evans/create-issue-from-file@v5
92114
with:
93115
title: "New Element Web release ${{ steps.release.outputs.tag }}"
94116
content-filepath: ./changelog-excerpt.md
95117
token: ${{ secrets.GITHUB_TOKEN }}
96-

0 commit comments

Comments
 (0)