test new yaml #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Résumé du push (table unique + message complet + liens) | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| REPO="${{ github.repository }}" | ||
| REPO_URL="https://github.com/${REPO}" | ||
| REF="${{ github.ref }}" | ||
| ACTOR="${{ github.actor }}" | ||
| BEFORE="${{ github.event.before }}" | ||
| AFTER="${{ github.sha }}" | ||
| RUN_TS_UTC="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" | ||
| echo "## Résumé (table unique)" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "" >> "$GITHUB_STEP_SUMMARY" | ||
| # Tableau unique (tout fusionné) | ||
| # Remarque: on évite les colonnes typées numériques (---:) pour pouvoir écrire du texte (ex: lien repo) dans "Valeur". | ||
| echo "| Section | Dépôt | Commit | Contributeur | Date commit | Message (complet) | Indicateur | Valeur | Fichier | + | - |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "|---|---|---|---|---|---|---|---|---|---:|---:|" >> "$GITHUB_STEP_SUMMARY" | ||
| # LIGNE META: lien vers le dépôt + infos de branche | ||
| echo "| META | [${REPO}](${RE| | | Branche | \`${REF}\` | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| META | ${REPO} | | | | | Actor | \`${ACTOR}\` | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| META | ${REPO} | | | | | Date run (UTC) | \`${RUN_TS_UTC}\` | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| META | [${REPO}](${REPO_URL| Range | \`${BEFORE}..${AFTER}\` | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| # 1) COMMITS (SHA cliquable + message complet) | ||
| # - SHA court + lien vers le commit | ||
| # - message: remplace les retours ligne par <br> pour garder le message complet (titre + corps) | ||
| # - échappe le '|' qui casserait le tableau | ||
| jq -r --arg repo_url "$REPO_URL" --arg repo "$REPO" ' | ||
| .commits[] | ||
| | .short = (.id[0:7]) | ||
| | .msg = (.message | gsub("\r\n|\n|\r"; "<br>") | gsub("\\|"; "\\\\|")) | ||
| | "| COMMITS | " + $repo + "" | ||
| + " | " + .short + "" | ||
| + " | " + (.author.name // "unknown") | ||
| + " | " + (.timestamp // "unknown") | ||
| + " | " + .msg | ||
| + " | | | | | |" | ||
| ' "$GITHUB_EVENT_PATH" >> "$GITHUB_STEP_SUMMARY" | ||
| # 2) STATS globales (diff BEFORE -> AFTER) | ||
| # GitHub Actions ne fournit plus added/removed/modified dans le payload push → calcul via git diff --numstat. [3](https://docs.posit.co/ide/user/ide/guide/productivity/add-ins.html)[4](https://cran.r-project.org/web/packages/rstudioapi/vignettes/introduction.html) | ||
| if [[ "$BEFORE" =~ ^0+$ ]]; then | ||
| echo "| STATS | [${REO} | | | | | Premier push | BEFORE=000… (diff non calculable) | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| else | ||
| NUMSTAT="$(git diff --numstat "$BEFORE" "$AFTER")" | ||
| FILES_CHANGED="$(echo "$NUMSTAT" | wc -l | tr -d ' ')" | ||
| ADDED="$(echo "$NUMSTAT" | awk '{a+=$1} END {print a+0}')" | ||
| REMOVED="$(echo "$NUMSTAT" | awk '{d+=$2} END {print d+0}')" | ||
| MODIFIED_EST=$(( ADDED < REMOVED ? ADDED : REMOVED )) | ||
| echo "| STATS | [${EPO} | | | | | Fichiers changés | ${FILES_CHANGED} | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| STATS | ${REPO} | | | | | Lignes ajoutées (+) | ${ADDED} | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| STATS | ${REPO} | | | | | Lignes supprimées (-) | ${REMOVED} | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "| STATS | ${REPO} | | | | | Estimation lignes modifiées (~) | ${ echo "| STATS | ${REPO} | | | | | Estimation lignes modifiées (~) | ${MODIFIED_EST} | | | |" >> "$GITHUB_STEP_SUMMARY" | ||
| # 3) Détail par fichier (+/-) | ||
| echo "$NUMSTAT" | awk -F '\t' '{printf "| FICHIERS | '"$REPO"' | | | | | | | `%s` | %s | %s |\n", $3, $1, $2}' >> "$GITHUB_STEP_SUMMARY" | ||