Skip to content

Commit a64e791

Browse files
committed
Refactor workflow comments for clarity and consistency, improve GitHub expression syntax, and enhance README commit process
1 parent 42809a5 commit a64e791

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

.github/workflows/0-start-exercise.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Step 0 # Start Exercise
22

33
on:
44
# Auto-start quand le dépôt élève est créé depuis la template
5-
# Le premier push contient .github/**, donc ça déclenche
5+
# Le premier état contient .github/**, donc ce push déclenche Step 0
66
push:
77
branches: [ main ]
88
paths:
@@ -16,7 +16,7 @@ permissions:
1616
pull-requests: write
1717
actions: write
1818

19-
# Empêche deux exécutions en parallèle sur la même ref
19+
# Évite deux exécutions concurrentes sur la même ref
2020
concurrency:
2121
group: ${{ github.workflow }}-${{ github.ref }}
2222
cancel-in-progress: true
@@ -26,18 +26,19 @@ env:
2626

2727
jobs:
2828
start_exercise:
29-
# Ne tourne pas sur un repo encore marqué template
3029
name: Start Exercise
31-
if: !github.event.repository.is_template
30+
# ✅ Corrigé, utilisation de la syntaxe d'expression GitHub
31+
if: ${{ !github.event.repository.is_template }}
3232
uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.7.1
3333
with:
3434
exercise-title: "GitHub Basics"
3535
intro-message: "Bienvenue, cette issue va te guider pas à pas dans le cours."
3636

3737
post_next_step_content:
3838
name: Post next step content
39-
runs-on: ubuntu-latest
4039
needs: [start_exercise]
40+
if: ${{ needs.start_exercise.result == 'success' }}
41+
runs-on: ubuntu-latest
4142
env:
4243
ISSUE_NUMBER: ${{ needs.start_exercise.outputs.issue-number }}
4344
ISSUE_REPOSITORY: ${{ github.repository }}
@@ -49,6 +50,12 @@ jobs:
4950
persist-credentials: true
5051
fetch-depth: 0
5152

53+
# Se place explicitement sur le dernier commit distant
54+
- name: Sync to latest remote main
55+
run: |
56+
git fetch origin main
57+
git checkout -B main origin/main
58+
5259
- name: Create comment - add step content
5360
uses: GrantBirki/comment@v2.1.1
5461
with:
@@ -66,7 +73,7 @@ jobs:
6673
issue-number: ${{ env.ISSUE_NUMBER }}
6774
file: .github/i18n/fr/watching-for-progress.md
6875

69-
# Écrase le README EN par le README FR, APRÈS start_exercise
76+
# ÉCRASE le README EN par le README FR
7077
- name: Construire README FR
7178
id: build-readme-fr
7279
uses: skills/action-text-variables@v3
@@ -82,7 +89,7 @@ jobs:
8289
env:
8390
README_CONTENT: ${{ steps.build-readme-fr.outputs.updated-text }}
8491

85-
- name: Commit README.md (FR) avec rebase auto
92+
- name: Commit et push du README FR
8693
shell: bash
8794
env:
8895
GIT_AUTHOR_NAME: github-actions[bot]
@@ -91,16 +98,14 @@ jobs:
9198
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
9299
run: |
93100
set -e
94-
BRANCH="${GITHUB_REF_NAME:-main}"
95101
git add README.md
96102
if git diff --cached --quiet; then
97103
echo "Aucun changement à committer"
98104
else
99105
git commit -m "docs(readme): version FR pour l’intro"
100106
fi
101-
git fetch origin "$BRANCH"
102-
git pull --rebase origin "$BRANCH" || true
103-
git push origin "HEAD:$BRANCH"
107+
# On est déjà rebased sur origin/main, le push sera fast-forward
108+
git push origin main
104109
105110
- name: Remplacer le corps de l’issue par la version FR
106111
uses: actions/github-script@v7
@@ -134,7 +139,7 @@ jobs:
134139
env:
135140
GH_TOKEN: ${{ github.token }}
136141

137-
# Important, on désactive Step 0 pour empêcher toute ré-exécution ultérieure
142+
# On désactive Step 0 pour empêcher tout nouveau run
138143
- name: Disable current workflow
139144
run: gh workflow disable "${{ github.workflow }}"
140145
env:

0 commit comments

Comments
 (0)