📚 Cheatsheet

Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.

Snippets 6

Retour
Accéder aux entrées d'un workflow_dispatch
Intermédiaire
run: echo "Environnement: ${{ github.event.inputs.environment }}"
Condition if avec le contexte
Intermédiaire
steps:
  - name: Déployer
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    run: ./deploy.sh
Fonction contains()
Intermédiaire
if: contains(github.head_ref, 'feature')
Fonction startsWith()
Intermédiaire
if: startsWith(github.ref, 'refs/tags/')
Utiliser le contexte github
Facile
run: echo "Commit déclencheur : ${{ github.sha }}"
Utiliser le contexte secrets
Facile
run: curl -H "Authorization: Bearer ${{ secrets.API_TOKEN }}" https://api.example.com