File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Push summary + send to plumber
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ summarize-and-send :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Résumé du push (tous les commits)
14+ shell : bash
15+ run : |
16+ echo "## Résumé du push" >> "$GITHUB_STEP_SUMMARY"
17+ echo "" >> "$GITHUB_STEP_SUMMARY"
18+
19+ # Infos globales (repo, branche, etc.) via le contexte GitHub Actions
20+ echo "**Repo :** \`${{ github.repository }}\`" >> "$GITHUB_STEP_SUMMARY"
21+ echo "**Branche :** \`${{ github.ref }}\`" >> "$GITHUB_STEP_SUMMARY"
22+ echo "**Actor :** \`${{ github.actor }}\`" >> "$GITHUB_STEP_SUMMARY"
23+ echo "**After (SHA) :** \`${{ github.sha }}\`" >> "$GITHUB_STEP_SUMMARY"
24+ echo "" >> "$GITHUB_STEP_SUMMARY"
25+
26+ # Compter le nombre de commits présents dans l'événement
27+ COUNT=$(jq '.commits | length' "$GITHUB_EVENT_PATH")
28+ echo "**Nombre de commits dans ce push :** $COUNT" >> "$GITHUB_STEP_SUMMARY"
29+ echo "" >> "$GITHUB_STEP_SUMMARY"
30+
31+ # Tableau Markdown
32+ echo "| SHA | Auteur | Message |" >> "$GITHUB_STEP_SUMMARY"
33+ echo "|---|---|---|" >> "$GITHUB_STEP_SUMMARY"
34+
35+ # Génère une ligne par commit
36+ # - tronque le SHA
37+ # - remplace retours à la ligne dans le message
38+ # - échappe le caractère '|' qui casse les tableaux Markdown
39+ jq -r '
40+ .commits[]
41+ | .message |= gsub("\r\n|\n|\r"; " ")
42+ | .message |= gsub("\\|"; "\\\\|")
43+ | "| [`\(.id[0:7])`](\(.url)) | \(.author.name) | \(.message) |"
44+ ' "$GITHUB_EVENT_PATH" >> "$GITHUB_STEP_SUMMARY"
You can’t perform that action at this time.
0 commit comments