Skip to content

Add scheduled multi-repo workflow for automated daily Wordle/Connections data sync#5

Merged
28pins merged 6 commits into
mainfrom
copilot/add-github-actions-workflow
May 25, 2026
Merged

Add scheduled multi-repo workflow for automated daily Wordle/Connections data sync#5
28pins merged 6 commits into
mainfrom
copilot/add-github-actions-workflow

Conversation

Copilot AI commented May 25, 2026

Copy link
Copy Markdown
Contributor

This PR adds a GitHub Actions workflow to automate scripts/populate_dailyWords.js execution and propagate generated data updates across CLIWordGames, CLIGames-web, Wrdli, and Cli-nnections. It supports both scheduled runs (0 0 * * 1) and manual dispatch, with automated commit/push per modified repository.

  • Workflow trigger + permissions

    • Added .github/workflows/update-daily-words.yml
    • Configured:
      • schedule: - cron: '0 0 * * 1'
      • workflow_dispatch
      • permissions: contents: write
  • Repository orchestration

    • Checks out CLIWordGames as the primary workspace.
    • Checks out sibling repos (28pins/CLIGames-web, 28pins/Wrdli, 28pins/Cli-nnections) into sibling directories for writeback.
    • Requires CROSS_REPO_PUSH_TOKEN for cross-repo write access and fails early with a clear message if unset.
  • Data generation + synchronization

    • Sets up Node.js 20 and runs:
      • node scripts/populate_dailyWords.js
    • Copies generated artifacts from workspace outputs into each checked-out sibling repo target path.
  • Automated commit/push behavior

    • Detects per-repo changes via git status --porcelain.
    • Commits only when changes exist.
    • Uses GitHub Actions bot identity:
      • github-actions[bot]
      • github-actions[bot]@users.noreply.github.com
    • Pushes each changed repo independently, with branch fallback logic for detached-head/default-branch cases.
'on':
  schedule:
    - cron: '0 0 * * 1'
  workflow_dispatch:

- name: Run populate script
  run: node scripts/populate_dailyWords.js
Original prompt

Create a GitHub Actions workflow that runs every 2 weeks to automatically populate daily Wordle words and Connections puzzles by executing the scripts/populate_dailyWords.js script, then commit and push the changes to all affected repositories (CLIWordGames, CLIGames-web, Wrdli, and Cli-nnections).

The workflow should:

  • Schedule to run every Monday at midnight UTC using cron: '0 0 * * 1'
  • Allow manual triggers via workflow_dispatch
  • Checkout the CLIWordGames repository
  • Clone sibling repos (CLIGames-web, Wrdli, Cli-nnections) since the script writes to their directories
  • Setup Node.js 20
  • Execute the populate script
  • Commit and push changes to each modified repository
  • Use the GitHub Actions bot as the commit author

This enables automated updates without manual intervention from a server.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Is it possible using github actions to every 2 weeks have a server run my node script and it changes my repos files and then the server committs that

Assistant: Yes — GitHub Actions can do that.

A common setup is:

  1. Schedule the workflow to run every 2 weeks using cron.
  2. Run your Node.js script inside the action.
  3. Allow the workflow to modify files in the repo.
  4. Commit and push the changes back to the repository.

A few important notes:

  • The runner is usually a GitHub-hosted ephemeral VM, not your own server.
  • If you specifically want your own server to run the script, you’d typically use:
    • a self-hosted runner installed on that server, or
    • have GitHub Actions call your server via SSH/API.
  • The workflow can commit changes using git commit and git push.
  • You’ll need proper permissions, usually:
    • permissions: contents: write

Here’s a simple example scheduled every 2 weeks:

on:
  schedule:
    - cron: '0 0 */14 * *'
  workflow_dispatch:

permissions:
  contents: write

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '20'

      - run: npm ci
      - run: node scripts/update-files.js

      - name: Commit and push changes
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add .
          git commit -m "Automated file update" || echo "No changes to commit"
          git push

A couple caveats:

  • cron: '0 0 */14 * *' is not a perfect “every 2 weeks” schedule in the calendar sense; it means “every 14 days of the month,” which can behave oddly across month boundaries.
  • If you need exactly every 2 weeks, a better approach is often:
    • run daily, and
    • have the workflow check whether 14 days have passed since the last run, or
    • use an external scheduler.

If you want, I can help you with:

  • a workflow that runs on your own server
  • a workflow that commits changes safely
  • or a complete example tailored to your repo

User: It is this script

Assistant: Perfect! This script fetches daily Wordle and Connections puzzle data from the NYT API and writes it to multiple files across your repos.

Here's a GitHub Actions workflow that will run this every 2 weeks on GitHub's servers and commit the changes:

name: Update Daily Words & Puzzles

on:
  schedule:
    # Run every 2 weeks (every Monday at midnight UTC)
    - cron: '0 0 * * 1'
  workflow_dispatch:  # Allow manual trigger

permissions:
  contents: write

jobs:
  populate:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout CLIWordGames
        uses: actions/checkout@v4
        with:
          repository: 28pins/CLIWordGames
          token: ${{ secrets.GITHUB_TOKEN }}

      - name: Checkout sibling repos
        run: |
          cd ..
          git clone https://github.com/28pins/CLIGames-web.git
          git clone https://github.com/28pins/Wrdli.git
          git clone https://github.com/28pins/Cli-nnections.git

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Run populate script
        run: node scripts/populate_dailyWords.js

      - name: Commit and push CLIWordGames changes
        working-directory: CLIWordGames
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add .
          git commit -m "chore: Update daily words and puzzles" || echo "No changes in CLIWordGames"
          git push

      - name: Commit and push CLIGames-web changes
        working-directory: ../CLIGames-web
        run: |
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add .
     ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

Copilot AI changed the title [WIP] Add GitHub Actions workflow to automate Wordle and Connections updates Add scheduled multi-repo workflow for automated daily Wordle/Connections data sync May 25, 2026
Copilot finished work on behalf of 28pins May 25, 2026 20:00
Copilot AI requested a review from 28pins May 25, 2026 20:00
@28pins 28pins marked this pull request as ready for review May 25, 2026 20:13
Copilot AI review requested due to automatic review settings May 25, 2026 20:13
@28pins 28pins merged commit 7e1fda4 into main May 25, 2026
1 check failed
@28pins 28pins deleted the copilot/add-github-actions-workflow branch May 25, 2026 20:14
Copilot AI removed the request for review from Copilot May 25, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants