Skip to content

Moderniser le parcours web et assouplir les validations #75

Moderniser le parcours web et assouplir les validations

Moderniser le parcours web et assouplir les validations #75

name: Step 0 # Démarrer l'exercice
on:
push:
branches:
- main
permissions:
contents: write
actions: write
issues: write
env:
STEP_1_FILE: ".github/steps/1-create-a-branch.md"
TOOLKIT_REPOSITORY: "ENSTASIMOV/exercise-toolkit-fr"
TOOLKIT_REF: "cc297e897016fc19c88ac89ecd9b477abdb291d9"
jobs:
start_exercise:
if: |
!github.event.repository.is_template
name: Démarrer l'exercice
uses: ENSTASIMOV/exercise-toolkit-fr/.github/workflows/start-exercise.yml@cc297e897016fc19c88ac89ecd9b477abdb291d9
with:
exercise-title: "GitHub Basics"
intro-message: "Tu vas découvrir GitHub en pratiquant : d'abord dans l'Issue du cours, puis directement dans la conversation de ta pull request."
manage-workflows: true
post_next_step_content:
name: Afficher l'étape 1
runs-on: ubuntu-latest
needs: [start_exercise]
env:
ISSUE_REPOSITORY: ${{ github.repository }}
ISSUE_NUMBER: ${{ needs.start_exercise.outputs.issue-number }}
steps:
- name: Récupérer le dépôt
uses: actions/checkout@v6
with:
ref: main
- name: Récupérer les templates français
uses: actions/checkout@v6
with:
repository: ${{ env.TOOLKIT_REPOSITORY }}
path: exercise-toolkit-fr
ref: ${{ env.TOOLKIT_REF }}
- name: Publier l'étape 1
uses: GrantBirki/comment@v2.1.1
with:
repository: ${{ env.ISSUE_REPOSITORY }}
issue-number: ${{ env.ISSUE_NUMBER }}
file: ${{ env.STEP_1_FILE }}
- name: Indiquer que la progression est surveillée
uses: GrantBirki/comment@v2.1.1
with:
repository: ${{ env.ISSUE_REPOSITORY }}
issue-number: ${{ env.ISSUE_NUMBER }}
file: exercise-toolkit-fr/markdown-templates/step-feedback/watching-for-progress.md
- name: Activer uniquement l'étape 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
current_state="$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/0-start-exercise.yml" --jq '.state')"
if [ "$current_state" = "active" ]; then
gh api --method PUT "repos/${GITHUB_REPOSITORY}/actions/workflows/0-start-exercise.yml/disable"
fi
next_state="$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/1-create-a-branch.yml" --jq '.state')"
if [ "$next_state" != "active" ]; then
gh api --method PUT "repos/${GITHUB_REPOSITORY}/actions/workflows/1-create-a-branch.yml/enable"
fi