Skip to content

Auto Commit. The green boxes grid as an excuse to teach GitHub Actions

License

Notifications You must be signed in to change notification settings

lucianofedericopereira/autocommit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗺️ 𝓐𝓾𝓽𝓸-𝓒𝓸𝓶𝓶𝓲𝓽

Script for GitHub Actions Learning

Guybrush Ulysses Threepwood

Guybrush Ulysses Threepwood

The famous wannabe pirate from the Monkey Island series.

English

⚓ The Objective: Becoming a Coding Captain

The goal isn't to artificially inflate "GitHub green boxes"those colored indicators of activity. Instead, it's to give you hands-on experience with 🛠️ GitHub Actions.

🏴‍☠️ Don't Be a Sloppy Pirate, Be a Meticulous Programmer

The name Guybrush Threepwood? That's a nod to the classic character from the Monkey Island series; he’s a notorious wannabe pirate.

And here’s where Goodhart's law comes in: 📉 "When a measure becomes a target, it ceases to be a good measure."

Why is this relevant? Because using the number of commits as a KPI (Key Performance Indicator) can lead to misleading practices. Commits should represent meaningful updates to code, not just effort to fill up your commit history.

Here's more about GitHub Actions and how to implement them.

Sail Straight with Good Practices 🏴‍☠️

Inexperienced or bad practice often shows itself in repos that are only committed once in bulk or have meaningless commit messages. We aim to help you recognize and avoid these pitfalls.

Check out the 📜 GitHub Action

Español

⚓ El Objetivo: Convertirse en un Capitán de Repositorios.

La meta no es inflar artificialmente los "cuadros verdes de GitHub" – esos indicadores de actividad. En cambio, es darte experiencia práctica con 🛠️ GitHub Actions.

🏴‍☠️ No seas un Pirata Desordenado, Sé un Programador Meticuloso

El nombre Guybrush Threepwood? Eso es un guiño al clásico personaje de la serie Monkey Island; es un notorio aspirante a pirata. Y aquí es donde entra en juego la ley de Goodhart: 📉 "Cuando una medida se convierte en objetivo, deja de ser una buena medida."

¿Por qué es esto relevante? Porque usar el número de commits como un KPI (Indicador Clave de Desempeño) puede llevar a prácticas engañosas. Los commits deben representar actualizaciones significativas del código, no solo esfuerzo por llenar tu historial de commits.

🧭 Navega Recto con Buenas Prácticas

La falta de experiencia o las malas prácticas a menudo se muestran en repos que solo se comprometen una vez en bloque o tienen mensajes de commit sin sentido. Queremos ayudarte a reconocer y evitar estos problemas.

Echa un vistazo a la 📜 GitHub Action.

Italiano

⚓ L'Obiettivo: Diventare un Capitano Codificatore

Lo scopo non è gonfiare artificialmente i "box verdi di GitHub" – quegli indicatori di attività. Invece, è darti esperienza pratica con GitHub Actions. 🛠️

🏴‍☠️ Non essere un Pirata Disordinato, Sii un Programmatore Meticoloso

Il nome Guybrush Threepwood? È un riferimento al classico personaggio della serie Monkey Island; è un noto aspirante pirata. Ed ecco dove entra in gioco la legge di Goodhart: "Quando una misura diventa un obiettivo, cessa di essere una buona misura." 📉

Perché è rilevante? Perché usare il numero di commit come KPI (Indicatore Chiave di Prestazione) può portare a pratiche fuorvianti. I commit dovrebbero rappresentare aggiornamenti significativi nel codice, non solo sforzi per riempire la cronologia dei commit.

🧭 Naviga Dritto con Buone Pratiche

La mancanza di esperienza o le cattive pratiche spesso si manifestano in repos che vengono commitati solo una volta in blocco o che hanno messaggi di commit insignificanti. Vogliamo aiutarti a riconoscere e evitare queste insidie.

Dai un'occhiata alla 📜 GitHub Action.

Deutsch

⚓ Das Ziel: Ein Programmierkapitän werden

Das Ziel ist nicht, die "GitHub Grünkästchen" – diese Aktivitätsindikatoren – künstlich aufzublähen. Stattdessen soll es dir praktische Erfahrungen mit GitHub Actions verschaffen. 🛠️

🏴‍☠️ Kein Schlampiger Pirat, sondern ein Gründlicher Programmierer

Der Name Guybrush Threepwood? Das ist ein Hinweis auf den klassischen Charakter aus der Monkey Island-Serie; er ist ein berüchtigter Möchtegernpirat. Und hier kommt das Goodhart'sche Gesetz ins Spiel: "Wenn ein Maßstab zum Ziel wird, hört er auf, ein guter Maßstab zu sein." 📉

Warum ist das relevant? Weil die Nutzung der Anzahl der Commits als KPI (Key Performance Indicator) zu irreführenden Praktiken führen kann. Commits sollten bedeutende Code-Updates repräsentieren, nicht nur die Bemühung, dein Commit-Historie zu füllen.

🧭 Mit Guten Praktiken Kurs Halten

Unerfahrenheit oder schlechte Praktiken zeigen sich oft in Repos, die nur einmal in der Masse committet werden oder bedeutungslose Commit-Nachrichten haben. Wir möchten dir helfen, diese Stolperfallen zu erkennen und zu vermeiden.

Überprüfen 📜 GitHub Action.

Français

⚓ L'Objectif : Devenir un Capitaine de la Programmation

Le but n'est pas de gonfler artificiellement les "cases vertes de GitHub" – ces indicateurs d'activité. Au lieu de cela, c'est de vous donner une expérience pratique avec GitHub Actions. 🛠️

🏴‍☠️ Ne Soyez pas un Pirate Négligent, Soyez un Programmeur Méticuleux

Le nom Guybrush Threepwood? C'est un clin d'œil au personnage classique de la série Monkey Island ; il est un célèbre pirate en herbe. Et voici où intervient la loi de Goodhart : "Lorsqu'une mesure devient un objectif, elle cesse d'être une bonne mesure." 📉

Pourquoi est-ce pertinent ? Parce qu'utiliser le nombre de commits comme KPI (Indicateur Clé de Performance) peut mener à des pratiques trompeuses. Les commits doivent représenter des mises à jour significatives du code, pas seulement des efforts pour remplir votre historique de commits.

🧭 Naviguez Droit avec de Bonnes Pratiques

L'inexpérience ou les mauvaises pratiques se manifestent souvent dans des dépôts qui sont seulement commités en bloc ou qui ont des messages de commit insignifiants. Nous visons à vous aider à reconnaître et éviter ces pièges.

Consultez la 📜 GitHub Action.

Action

autocommit.yml (action)

# EN: Autocommit (daily)       The name of the workflow
# ES: Autocommit (diario)      Nombre del flujo de trabajo
# IT: Autocommit (giornaliero) Nome del flusso di lavoro
# DE: Autocommit (täglich)     Der Name des Workflows
# FR: Autocommit (quotidien)   Nom du flux de travail
name: Autocommit (daily)
on:

  # EN: Schedule the action to run daily at midnight (UTC)
  # ES: Programa la acción para ejecutarse diariamente a medianoche (UTC)
  # IT: Pianifica l'azione per l'esecuzione quotidiana a mezzanotte (UTC)
  # DE: Plane die Aktion, die täglich um Mitternacht (UTC) ausgeführt wird
  # FR: Planifie l'action pour s'exécuter quotidiennement à minuit (UTC)
  schedule:
    - cron: '0 0 * * *'

  # EN: Allow manual triggering of the workflow
  # ES: Permitir el desencadenamiento manual del flujo de trabajo
  # IT: Consenti l'attivazione manuale del flusso di lavoro
  # DE: Erlaube das manuelle Auslösen des Workflows
  # FR: Permettre le déclenchement manuel du flux de travail
  workflow_dispatch:
jobs:
  commit:
    # EN: Run the job on the latest Ubuntu environment
    # ES: Ejecutar el trabajo en el entorno más reciente de Ubuntu
    # IT: Esegui il lavoro sull'ambiente più recente di Ubuntu
    # DE: Führe den Job auf der neuesten Ubuntu-Umgebung aus
    # FR: Exécuter le travail sur l'environnement Ubuntu le plus récent
    runs-on: ubuntu-latest
    steps:
      # EN: Checkout the repository code using the latest version of the action
      # ES: Clonar el código del repositorio usando la versión más reciente de la acción
      # IT: Clona il codice del repository utilizzando l'ultima versione dell'azione
      # DE: Klone den Repository-Code mit der neuesten Version der Aktion
      # FR: Cloner le code du dépôt en utilisant la dernière version de l'action
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          # EN: Target the main branch
          # ES: Apuntar a la rama principal
          # IT: Target la branch principale
          # DE: Ziel die Hauptfiliale
          # FR: Cibler la branche principale
          ref: main 
      # EN: Set name for the commit
      # ES: Establecer el nombre del commit
      # IT: Imposta il nome per il commit
      # DE: Setze den Namen für den Commit
      # FR: Définir le nom pour le commit
      - name: Create file and commit

        #run

        #COMMIT_NAME="Luciano Federico Pereira"
        # EN: Set email for the commit
        # ES: Establecer el correo electrónico del commit
        # IT: Imposta l'email per il commit
        # DE: Setze die E-Mail für den Commit
        # FR: Définir l'email pour le commit
        # COMMIT_EMAIL="lucianopereira [at] posteo.es"

        # EN: File to be created/updated
        # ES: Archivo a crear/actualizar
        # IT: File da creare/aggiornare
        # DE: Zu erstellende/aktualisierende Datei
        # FR: Fichier à créer / mettre à jour
        # COMMIT_FILE="helloWorld.md"

        # EN: Greeting message
        # ES: Mensaje de saludo
        # IT: Messaggio di saluto
        # DE: Begrüßungsnachricht
        # FR: Message de salutation
        # COMMIT_GREET="Hi, my name is ~~Guybrush Threepwood~~ **${COMMIT_NAME}**, and I am a ~~wannabe pirate~~ **programmer**.<br><br>A short song: "

        # EN: Fixed part of the song
        # ES: Parte fija de la canción
        # IT: Parte fissa della canzone
        # DE: Fester Teil des Liedes
        # FR: Partie fixe de la chanson
        # COMMIT_SONG=" bounty of doubloons gleams in the sun, a treasure hunt has just begun! Arrr!"

        # EN: Extract the current counter from the file or set to 0 if not found
        # ES: Extraer el contador actual del archivo o establecerlo en 0 si no se encuentra
        # IT: Estrai l'attuale contatore dal file o impostalo su 0 se non trovato
        # DE: Extrahiere den aktuellen Zähler aus der Datei oder setze ihn auf 0, wenn nicht gefunden
        # FR: Extraire le compteur actuel du fichier ou le définir à 0 s'il n'est pas trouvé
        # COMMIT_COUNTER=$(grep -oP "\d+(?=${COMMIT_SONG})" "$COMMIT_FILE" || echo 0)

        # EN: Increment the counter
        # ES: Incrementar el contador
        # IT: Incrementa il contatore
        # DE: Inkrementiere den Zähler
        # FR: Incrémenter le compteur
        # COMMIT_COUNTER=$((COMMIT_COUNTER + 1))

        # EN: Write updated content to the file
        # ES: Escribir el contenido actualizado en el archivo
        # IT: Scrivi il contenuto aggiornato nel file
        # DE: Schreibe den aktualisierten Inhalt in die Datei
        # FR: Écrire le contenu mis à jour dans le fichier
        # echo "${COMMIT_GREET}${COMMIT_COUNTER}${COMMIT_SONG}" > "$COMMIT_FILE"

        # EN: Configure Git with the commit name
        # ES: Configurar Git con el nombre del commit
        # IT: Configura Git con il nome del commit
        # DE: Konfiguriere Git mit dem Commit-Namen
        # FR: Configurer Git avec le nom du commit
        # git config --global user.name "${COMMIT_NAME}"

        # EN: Configure Git with the commit email
        # ES: Configurar Git con el correo electrónico del commit
        # IT: Configura Git con l'email del commit
        # DE: Konfiguriere Git mit der Commit-E-Mail
        # FR: Configurer Git avec l'email du commit
        # git config --global user.email "${COMMIT_EMAIL}"

        # EN: Add the file to the staging area
        # ES: Agregar el archivo al área de preparación
        # IT: Aggiungi il file all'area di staging
        # DE: Füge die Datei zur Staging-Area hinzu
        # FR: Ajouter le fichier à la zone de staging
        # git add "$COMMIT_FILE"

        # EN: Commit the changes with a custom message
        # ES: Hacer commit de los cambios con un mensaje personalizado
        # IT: Effettua il commit delle modifiche con un messaggio personalizzato
        # DE: Committe die Änderungen mit einer benutzerdefinierten Nachricht
        # FR: Commitez les modifications avec un message personnalisé
        # git commit -m ":octocat: Bounty Updated: ${COMMIT_COUNTER}"

        # EN: Push the commit to the main branch
        # ES: Empujar el commit a la rama principal
        # IT: Pusha il commit alla branch principale
        # DE: Pushe den Commit auf die Hauptbranch
        # FR: Pousser le commit vers la branche principale
        # git push origin main
        run: |
            COMMIT_NAME="Luciano Federico Pereira"
            COMMIT_EMAIL="lucianopereira [at] posteo.es"
            COMMIT_FILE="helloWorld.md"
            COMMIT_GREET="Hi, my name is ~~Guybrush Threepwood~~ **${COMMIT_NAME}**, and I am a ~~wannabe pirate~~ **programmer**.<br><br>A short song: "
            COMMIT_SONG=" bounty of doubloons gleams in the sun, a treasure hunt has just begun! Arrr!"
            COMMIT_COUNTER=$(grep -oP "\d+(?=${COMMIT_SONG})" "$COMMIT_FILE" || echo 0)
            COMMIT_COUNTER=$((COMMIT_COUNTER + 1))
            echo "${COMMIT_GREET}${COMMIT_COUNTER}${COMMIT_SONG}" > "$COMMIT_FILE"
            git config --global user.name "${COMMIT_NAME}"
            git config --global user.email "${COMMIT_EMAIL}"
            git add "$COMMIT_FILE"
            git commit -m ":octocat: Bounty Updated: ${COMMIT_COUNTER}"
            git push origin main
        env:
            # EN: Use the GitHub Actions token for authentication
            # ES: Usar el token de GitHub Actions para la autenticación
            # IT: Usa il token di GitHub Actions per l'autenticazione
            # DE: Verwende das GitHub Actions-Token zur Authentifizierung
            # FR: Utiliser le jeton de GitHub Actions pour l'authentification
            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

helloWorld.md

📜 helloWorld.md.

Rendered

Hi, my name is Guybrush Threepwood Luciano Federico Pereira, and I am a wannabe pirate programmer.

A short song: 1 bounty of doubloons gleams in the sun, a treasure hunt has just begun! Arrr!

Raw

Hi, my name is ~~Guybrush Threepwood~~ **Luciano Federico Pereira**, and I am a ~~wannabe pirate~~ **programmer**.<br><br>A short song: 1 bounty of doubloons gleams in the sun, a treasure hunt has just begun! Arrr!