/wordle-to-yaml-action

🟩 A GitHub action to archive your Wordle games

Primary LanguageTypeScript

wordle-action

Save Wordle scores to a JSON file. Pair it with the iOS Shortcut to automatically create a workflow dispatch event. Alternatively, use the Run workflow option from the "Actions" tab to paste in a recently played game to trigger the action.

Example output

{
  "totalPlayed": 9,
  "totalWon": 9,
  "totalWonPercent": "100",
  "streakCurrent": 5,
  "streakMax": 5,
  "distribution": {
    "1": 0,
    "2": 0,
    "3": 2,
    "4": 2,
    "5": 4,
    "6": 1,
    "X": 0
  },
  "games": [
    {
      "number": 210,
      "score": 3,
      "won": true,
      "board": ["🟩⬛⬛⬛⬛", "⬛⬛🟨🟩🟨", "🟩🟩🟩🟩🟩"],
      "boardWords": [
        "yes no no no no",
        "no no almost yes almost",
        "yes yes yes yes yes"
      ],
      "altText": "The player won the game in 3 guesses.",
      "date": "2022-01-15"
    }
  ]
}

See _data/wordle.json for an extended output.

Set up the workflow

To use this action, create a new workflow in .github/workflows and modify it as needed:

name: Wordle

on:
  workflow_dispatch:
    inputs:
      game:
        description: The Wordle game as formatted by the "Share" option seen after completing a game.
        required: true
        type: string
      date:
        description: The date you played Wordle (YYYY-MM-DD). The default date is today.
        type: string

jobs:
  update_library:
    runs-on: macOS-latest
    name: Wordle
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Wordle
        uses: katydecorah/wordle-action@v6.0.0
      - name: Commit files
        run: |
          git pull
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git commit -am "${{ env.WordleSummary }}"
          git push

Action options

  • wordleFileName: The file where you want to save your Wordle scores. Default: _data/wordle.json.

Trigger the action

To trigger the action, create a workflow dispatch event with the following body parameters:

{ 
  "ref": "main", // Required. The git reference for the workflow, a branch or tag name.
  "inputs": {
    "game": "", // Required. The Wordle game as formatted by the "Share" option seen after completing a game.
    "date": "", // The date you played Wordle (YYYY-MM-DD). The default date is today.
  }
}