@@ -2,32 +2,45 @@ name: Telegram New Components
22
33on :
44 workflow_dispatch : {}
5- push :
6- branches :
7- - master
8- paths :
9- - " docs/components/** "
5+ workflow_run :
6+ workflows :
7+ - Deploy
8+ types :
9+ - completed
1010
1111jobs :
1212 notify :
13- if : github.repository_owner == 'modx-pro'
13+ if : |
14+ github.repository_owner == 'modx-pro' &&
15+ (
16+ github.event_name != 'workflow_run' ||
17+ (
18+ github.event.workflow_run.conclusion == 'success' &&
19+ github.event.workflow_run.head_branch == 'master'
20+ )
21+ )
1422 runs-on : ubuntu-latest
1523 steps :
1624 - uses : actions/checkout@v4
1725 with :
1826 fetch-depth : 0
27+ ref : ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
1928
2029 - name : Detect new components
2130 id : detect
2231 shell : bash
2332 run : |
2433 set -euo pipefail
2534
26- BEFORE_SHA="${{ github.event.before }}"
27- AFTER_SHA="${{ github.sha }}"
28-
29- if [[ -z "$BEFORE_SHA" || "$BEFORE_SHA" == "0000000000000000000000000000000000000000" ]]; then
35+ if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
36+ AFTER_SHA="${{ github.event.workflow_run.head_sha }}"
3037 BEFORE_SHA="$(git rev-parse "${AFTER_SHA}^" 2>/dev/null || true)"
38+ else
39+ AFTER_SHA="${{ github.sha }}"
40+ BEFORE_SHA="${{ github.event.before }}"
41+ if [[ -z "$BEFORE_SHA" || "$BEFORE_SHA" == "0000000000000000000000000000000000000000" ]]; then
42+ BEFORE_SHA="$(git rev-parse "${AFTER_SHA}^" 2>/dev/null || true)"
43+ fi
3144 fi
3245
3346 if [[ -z "$BEFORE_SHA" ]]; then
@@ -119,9 +132,15 @@ jobs:
119132 description="$(escape_html "$description")"
120133 author="$(escape_html "$author")"
121134
135+ if [[ "$file" =~ /index\.md$ ]]; then
136+ doc_url="https://docs.modx.pro/components/${slug}/"
137+ else
138+ doc_url="https://docs.modx.pro/components/${slug}"
139+ fi
140+
122141 MESSAGE+="\n<b>${title}</b> — ${description}\n"
123142 MESSAGE+="Автор: ${author}\n"
124- MESSAGE+="<a href=\"https://docs.modx.pro/components/${slug}/ \">Открыть в документации </a>\n"
143+ MESSAGE+="<a href=\"${doc_url} \">Ознакомитися с документацией </a>\n"
125144 count=$((count + 1))
126145 done <<< "$ADDED_COMPONENTS"
127146
0 commit comments