From 55036a9f95859d5de18ee39b9e933886812f3686 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 May 2026 19:52:13 +0000 Subject: [PATCH 1/6] Initial plan From a06836328f06bf724d8d7a49a3c4141411db7f49 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 May 2026 19:55:15 +0000 Subject: [PATCH 2/6] feat: add automated workflow for daily words and puzzle sync Agent-Logs-Url: https://github.com/28pins/CLIWordGames/sessions/19ba3116-1e51-4fc4-89f1-69891c7c441a Co-authored-by: 28pins <262898015+28pins@users.noreply.github.com> --- .github/workflows/update-daily-words.yml | 87 ++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/workflows/update-daily-words.yml diff --git a/.github/workflows/update-daily-words.yml b/.github/workflows/update-daily-words.yml new file mode 100644 index 0000000..6fe51df --- /dev/null +++ b/.github/workflows/update-daily-words.yml @@ -0,0 +1,87 @@ +name: Update Daily Words & Puzzles + +'on': + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +permissions: + contents: write + +jobs: + populate: + runs-on: ubuntu-latest + env: + OWNER: 28pins + PUSH_TOKEN: ${{ secrets.CROSS_REPO_PUSH_TOKEN || secrets.GITHUB_TOKEN }} + COMMIT_MESSAGE: 'chore: update daily words and puzzles' + steps: + - name: Checkout CLIWordGames + uses: actions/checkout@v4 + with: + token: ${{ env.PUSH_TOKEN }} + fetch-depth: 0 + + - name: Clone sibling repositories + run: | + set -euo pipefail + cd /home/runner/work + git clone "https://x-access-token:${PUSH_TOKEN}@github.com/${OWNER}/CLIGames-web.git" CLIGames-web + git clone "https://x-access-token:${PUSH_TOKEN}@github.com/${OWNER}/Wrdli.git" Wrdli + git clone "https://x-access-token:${PUSH_TOKEN}@github.com/${OWNER}/Cli-nnections.git" Cli-nnections + + - name: Setup Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Run populate script + working-directory: /home/runner/work/CLIWordGames/CLIWordGames + run: node scripts/populate_dailyWords.js + + - name: Sync generated data to sibling repositories + run: | + set -euo pipefail + cp /home/runner/work/CLIWordGames/CLIWordGames/CLIGames-web/src/js/words_dailyWords.js /home/runner/work/CLIGames-web/src/js/words_dailyWords.js + cp /home/runner/work/CLIWordGames/CLIWordGames/CLIGames-web/src/js/categories_dailyPuzzles.js /home/runner/work/CLIGames-web/src/js/categories_dailyPuzzles.js + cp /home/runner/work/CLIWordGames/CLIWordGames/Wrdli/wrdli_words.js /home/runner/work/Wrdli/wrdli_words.js + cp /home/runner/work/CLIWordGames/CLIWordGames/Cli-nnections/cli-nnections_puzzles.js /home/runner/work/Cli-nnections/cli-nnections_puzzles.js + + - name: Commit and push updates + run: | + set -euo pipefail + + update_repo() { + local repo_dir="$1" + local branch="${2:-}" + + if [ ! -d "${repo_dir}/.git" ]; then + echo "Skipping ${repo_dir}; not a git repository." + return + fi + + if [ -z "$(git -C "${repo_dir}" status --porcelain)" ]; then + echo "No changes in ${repo_dir}" + return + fi + + git -C "${repo_dir}" config user.name "github-actions[bot]" + git -C "${repo_dir}" config user.email "github-actions[bot]@users.noreply.github.com" + git -C "${repo_dir}" add -A + git -C "${repo_dir}" commit -m "${COMMIT_MESSAGE}" + + if [ -z "${branch}" ] || [ "${branch}" = "HEAD" ]; then + branch="$(git -C "${repo_dir}" symbolic-ref --quiet --short HEAD || true)" + fi + + if [ -z "${branch}" ]; then + branch="$(git -C "${repo_dir}" remote show origin | sed -n '/HEAD branch/s/.*: //p')" + fi + + git -C "${repo_dir}" push origin "${branch}" + } + + update_repo "/home/runner/work/CLIWordGames/CLIWordGames" "${GITHUB_REF_NAME}" + update_repo "/home/runner/work/CLIGames-web" + update_repo "/home/runner/work/Wrdli" + update_repo "/home/runner/work/Cli-nnections" From f3221e3958cdc32155959606762e2df3949f7515 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 May 2026 19:56:50 +0000 Subject: [PATCH 3/6] fix: harden scheduled workflow token and repo sync handling Agent-Logs-Url: https://github.com/28pins/CLIWordGames/sessions/19ba3116-1e51-4fc4-89f1-69891c7c441a Co-authored-by: 28pins <262898015+28pins@users.noreply.github.com> --- .github/workflows/update-daily-words.yml | 79 +++++++++++++++++++----- 1 file changed, 62 insertions(+), 17 deletions(-) diff --git a/.github/workflows/update-daily-words.yml b/.github/workflows/update-daily-words.yml index 6fe51df..8a3044d 100644 --- a/.github/workflows/update-daily-words.yml +++ b/.github/workflows/update-daily-words.yml @@ -13,22 +13,45 @@ jobs: runs-on: ubuntu-latest env: OWNER: 28pins - PUSH_TOKEN: ${{ secrets.CROSS_REPO_PUSH_TOKEN || secrets.GITHUB_TOKEN }} + PUSH_TOKEN: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} COMMIT_MESSAGE: 'chore: update daily words and puzzles' steps: - name: Checkout CLIWordGames uses: actions/checkout@v4 with: - token: ${{ env.PUSH_TOKEN }} fetch-depth: 0 - - name: Clone sibling repositories + - name: Validate cross-repo token run: | set -euo pipefail - cd /home/runner/work - git clone "https://x-access-token:${PUSH_TOKEN}@github.com/${OWNER}/CLIGames-web.git" CLIGames-web - git clone "https://x-access-token:${PUSH_TOKEN}@github.com/${OWNER}/Wrdli.git" Wrdli - git clone "https://x-access-token:${PUSH_TOKEN}@github.com/${OWNER}/Cli-nnections.git" Cli-nnections + if [ -z "${PUSH_TOKEN}" ]; then + echo "CROSS_REPO_PUSH_TOKEN is required for cross-repository pushes." + exit 1 + fi + + - name: Checkout CLIGames-web + uses: actions/checkout@v4 + with: + repository: 28pins/CLIGames-web + token: ${{ env.PUSH_TOKEN }} + path: ../CLIGames-web + fetch-depth: 0 + + - name: Checkout Wrdli + uses: actions/checkout@v4 + with: + repository: 28pins/Wrdli + token: ${{ env.PUSH_TOKEN }} + path: ../Wrdli + fetch-depth: 0 + + - name: Checkout Cli-nnections + uses: actions/checkout@v4 + with: + repository: 28pins/Cli-nnections + token: ${{ env.PUSH_TOKEN }} + path: ../Cli-nnections + fetch-depth: 0 - name: Setup Node.js 20 uses: actions/setup-node@v4 @@ -36,16 +59,34 @@ jobs: node-version: '20' - name: Run populate script - working-directory: /home/runner/work/CLIWordGames/CLIWordGames + working-directory: ${{ github.workspace }} run: node scripts/populate_dailyWords.js - name: Sync generated data to sibling repositories run: | set -euo pipefail - cp /home/runner/work/CLIWordGames/CLIWordGames/CLIGames-web/src/js/words_dailyWords.js /home/runner/work/CLIGames-web/src/js/words_dailyWords.js - cp /home/runner/work/CLIWordGames/CLIWordGames/CLIGames-web/src/js/categories_dailyPuzzles.js /home/runner/work/CLIGames-web/src/js/categories_dailyPuzzles.js - cp /home/runner/work/CLIWordGames/CLIWordGames/Wrdli/wrdli_words.js /home/runner/work/Wrdli/wrdli_words.js - cp /home/runner/work/CLIWordGames/CLIWordGames/Cli-nnections/cli-nnections_puzzles.js /home/runner/work/Cli-nnections/cli-nnections_puzzles.js + + copy_file() { + local src="$1" + local dst="$2" + + if [ ! -f "${src}" ]; then + echo "Source file missing: ${src}" + exit 1 + fi + + if [ ! -d "$(dirname "${dst}")" ]; then + echo "Destination directory missing: $(dirname "${dst}")" + exit 1 + fi + + cp "${src}" "${dst}" + } + + copy_file "${GITHUB_WORKSPACE}/CLIGames-web/src/js/words_dailyWords.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/words_dailyWords.js" + copy_file "${GITHUB_WORKSPACE}/CLIGames-web/src/js/categories_dailyPuzzles.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/categories_dailyPuzzles.js" + copy_file "${GITHUB_WORKSPACE}/Wrdli/wrdli_words.js" "${GITHUB_WORKSPACE}/../Wrdli/wrdli_words.js" + copy_file "${GITHUB_WORKSPACE}/Cli-nnections/cli-nnections_puzzles.js" "${GITHUB_WORKSPACE}/../Cli-nnections/cli-nnections_puzzles.js" - name: Commit and push updates run: | @@ -75,13 +116,17 @@ jobs: fi if [ -z "${branch}" ]; then - branch="$(git -C "${repo_dir}" remote show origin | sed -n '/HEAD branch/s/.*: //p')" + branch="$(git -C "${repo_dir}" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')" + fi + + if [ -z "${branch}" ]; then + branch="main" fi git -C "${repo_dir}" push origin "${branch}" } - update_repo "/home/runner/work/CLIWordGames/CLIWordGames" "${GITHUB_REF_NAME}" - update_repo "/home/runner/work/CLIGames-web" - update_repo "/home/runner/work/Wrdli" - update_repo "/home/runner/work/Cli-nnections" + update_repo "${GITHUB_WORKSPACE}" "${GITHUB_REF_NAME}" + update_repo "${GITHUB_WORKSPACE}/../CLIGames-web" + update_repo "${GITHUB_WORKSPACE}/../Wrdli" + update_repo "${GITHUB_WORKSPACE}/../Cli-nnections" From faab0a587578b1e4ec3862175d8bb87e3e671bca Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 May 2026 19:57:47 +0000 Subject: [PATCH 4/6] fix: address workflow review feedback for token and branch handling Agent-Logs-Url: https://github.com/28pins/CLIWordGames/sessions/19ba3116-1e51-4fc4-89f1-69891c7c441a Co-authored-by: 28pins <262898015+28pins@users.noreply.github.com> --- .github/workflows/update-daily-words.yml | 28 ++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/update-daily-words.yml b/.github/workflows/update-daily-words.yml index 8a3044d..5351ede 100644 --- a/.github/workflows/update-daily-words.yml +++ b/.github/workflows/update-daily-words.yml @@ -12,8 +12,6 @@ jobs: populate: runs-on: ubuntu-latest env: - OWNER: 28pins - PUSH_TOKEN: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} COMMIT_MESSAGE: 'chore: update daily words and puzzles' steps: - name: Checkout CLIWordGames @@ -22,9 +20,11 @@ jobs: fetch-depth: 0 - name: Validate cross-repo token + env: + CROSS_REPO_PUSH_TOKEN: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} run: | set -euo pipefail - if [ -z "${PUSH_TOKEN}" ]; then + if [ -z "${CROSS_REPO_PUSH_TOKEN}" ]; then echo "CROSS_REPO_PUSH_TOKEN is required for cross-repository pushes." exit 1 fi @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v4 with: repository: 28pins/CLIGames-web - token: ${{ env.PUSH_TOKEN }} + token: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} path: ../CLIGames-web fetch-depth: 0 @@ -41,7 +41,7 @@ jobs: uses: actions/checkout@v4 with: repository: 28pins/Wrdli - token: ${{ env.PUSH_TOKEN }} + token: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} path: ../Wrdli fetch-depth: 0 @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@v4 with: repository: 28pins/Cli-nnections - token: ${{ env.PUSH_TOKEN }} + token: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} path: ../Cli-nnections fetch-depth: 0 @@ -65,6 +65,7 @@ jobs: - name: Sync generated data to sibling repositories run: | set -euo pipefail + SOURCE_ROOT="${GITHUB_WORKSPACE}" copy_file() { local src="$1" @@ -83,10 +84,10 @@ jobs: cp "${src}" "${dst}" } - copy_file "${GITHUB_WORKSPACE}/CLIGames-web/src/js/words_dailyWords.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/words_dailyWords.js" - copy_file "${GITHUB_WORKSPACE}/CLIGames-web/src/js/categories_dailyPuzzles.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/categories_dailyPuzzles.js" - copy_file "${GITHUB_WORKSPACE}/Wrdli/wrdli_words.js" "${GITHUB_WORKSPACE}/../Wrdli/wrdli_words.js" - copy_file "${GITHUB_WORKSPACE}/Cli-nnections/cli-nnections_puzzles.js" "${GITHUB_WORKSPACE}/../Cli-nnections/cli-nnections_puzzles.js" + copy_file "${SOURCE_ROOT}/CLIGames-web/src/js/words_dailyWords.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/words_dailyWords.js" + copy_file "${SOURCE_ROOT}/CLIGames-web/src/js/categories_dailyPuzzles.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/categories_dailyPuzzles.js" + copy_file "${SOURCE_ROOT}/Wrdli/wrdli_words.js" "${GITHUB_WORKSPACE}/../Wrdli/wrdli_words.js" + copy_file "${SOURCE_ROOT}/Cli-nnections/cli-nnections_puzzles.js" "${GITHUB_WORKSPACE}/../Cli-nnections/cli-nnections_puzzles.js" - name: Commit and push updates run: | @@ -116,7 +117,12 @@ jobs: fi if [ -z "${branch}" ]; then - branch="$(git -C "${repo_dir}" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||')" + branch="$(git -C "${repo_dir}" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||' || true)" + if [ -n "${branch}" ]; then + echo "Using remote default branch ${branch} for ${repo_dir}" + else + echo "origin/HEAD not set for ${repo_dir}; falling back to main" + fi fi if [ -z "${branch}" ]; then From eb6a5caf34d2f733aebd33d4b040779b118b7eeb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 May 2026 19:59:06 +0000 Subject: [PATCH 5/6] chore: refine workflow validation messages Agent-Logs-Url: https://github.com/28pins/CLIWordGames/sessions/19ba3116-1e51-4fc4-89f1-69891c7c441a Co-authored-by: 28pins <262898015+28pins@users.noreply.github.com> --- .github/workflows/update-daily-words.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/update-daily-words.yml b/.github/workflows/update-daily-words.yml index 5351ede..345053e 100644 --- a/.github/workflows/update-daily-words.yml +++ b/.github/workflows/update-daily-words.yml @@ -25,7 +25,7 @@ jobs: run: | set -euo pipefail if [ -z "${CROSS_REPO_PUSH_TOKEN}" ]; then - echo "CROSS_REPO_PUSH_TOKEN is required for cross-repository pushes." + echo "CROSS_REPO_PUSH_TOKEN secret is not set. Please configure it in repository settings to enable cross-repository pushes." exit 1 fi @@ -72,12 +72,12 @@ jobs: local dst="$2" if [ ! -f "${src}" ]; then - echo "Source file missing: ${src}" + echo "Source file missing: ${src}. Verify that the populate script completed successfully." exit 1 fi if [ ! -d "$(dirname "${dst}")" ]; then - echo "Destination directory missing: $(dirname "${dst}")" + echo "Destination directory missing: $(dirname "${dst}"). Verify that the target repository was checked out correctly." exit 1 fi @@ -117,18 +117,12 @@ jobs: fi if [ -z "${branch}" ]; then - branch="$(git -C "${repo_dir}" symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null | sed 's|^origin/||' || true)" - if [ -n "${branch}" ]; then - echo "Using remote default branch ${branch} for ${repo_dir}" - else - echo "origin/HEAD not set for ${repo_dir}; falling back to main" - fi - fi - - if [ -z "${branch}" ]; then + echo "No branch detected for ${repo_dir}; falling back to main" branch="main" fi + echo "Pushing ${repo_dir} to ${branch}" + git -C "${repo_dir}" push origin "${branch}" } From 71f15de85dc7bc47ab0ad4248a751132e32d4f04 Mon Sep 17 00:00:00 2001 From: Sam Clark Date: Mon, 25 May 2026 15:13:44 -0500 Subject: [PATCH 6/6] Update update-daily-words.yml --- .github/workflows/update-daily-words.yml | 128 ++++------------------- 1 file changed, 21 insertions(+), 107 deletions(-) diff --git a/.github/workflows/update-daily-words.yml b/.github/workflows/update-daily-words.yml index 345053e..e9b6cc8 100644 --- a/.github/workflows/update-daily-words.yml +++ b/.github/workflows/update-daily-words.yml @@ -1,9 +1,10 @@ name: Update Daily Words & Puzzles -'on': +on: schedule: + # Run every 2 weeks (every Monday at midnight UTC) - cron: '0 0 * * 1' - workflow_dispatch: + workflow_dispatch: # Allow manual trigger permissions: contents: write @@ -11,122 +12,35 @@ permissions: jobs: populate: runs-on: ubuntu-latest - env: - COMMIT_MESSAGE: 'chore: update daily words and puzzles' steps: - name: Checkout CLIWordGames uses: actions/checkout@v4 with: - fetch-depth: 0 + repository: 28pins/CLIWordGames + token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate cross-repo token - env: - CROSS_REPO_PUSH_TOKEN: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} - run: | - set -euo pipefail - if [ -z "${CROSS_REPO_PUSH_TOKEN}" ]; then - echo "CROSS_REPO_PUSH_TOKEN secret is not set. Please configure it in repository settings to enable cross-repository pushes." - exit 1 - fi - - - name: Checkout CLIGames-web - uses: actions/checkout@v4 - with: - repository: 28pins/CLIGames-web - token: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} - path: ../CLIGames-web - fetch-depth: 0 - - - name: Checkout Wrdli - uses: actions/checkout@v4 - with: - repository: 28pins/Wrdli - token: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} - path: ../Wrdli - fetch-depth: 0 - - - name: Checkout Cli-nnections - uses: actions/checkout@v4 - with: - repository: 28pins/Cli-nnections - token: ${{ secrets.CROSS_REPO_PUSH_TOKEN }} - path: ../Cli-nnections - fetch-depth: 0 - - - name: Setup Node.js 20 + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' - name: Run populate script - working-directory: ${{ github.workspace }} run: node scripts/populate_dailyWords.js - - name: Sync generated data to sibling repositories + - name: Commit and push CLIWordGames changes + working-directory: CLIWordGames run: | - set -euo pipefail - SOURCE_ROOT="${GITHUB_WORKSPACE}" - - copy_file() { - local src="$1" - local dst="$2" - - if [ ! -f "${src}" ]; then - echo "Source file missing: ${src}. Verify that the populate script completed successfully." - exit 1 - fi - - if [ ! -d "$(dirname "${dst}")" ]; then - echo "Destination directory missing: $(dirname "${dst}"). Verify that the target repository was checked out correctly." - exit 1 - fi - - cp "${src}" "${dst}" - } - - copy_file "${SOURCE_ROOT}/CLIGames-web/src/js/words_dailyWords.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/words_dailyWords.js" - copy_file "${SOURCE_ROOT}/CLIGames-web/src/js/categories_dailyPuzzles.js" "${GITHUB_WORKSPACE}/../CLIGames-web/src/js/categories_dailyPuzzles.js" - copy_file "${SOURCE_ROOT}/Wrdli/wrdli_words.js" "${GITHUB_WORKSPACE}/../Wrdli/wrdli_words.js" - copy_file "${SOURCE_ROOT}/Cli-nnections/cli-nnections_puzzles.js" "${GITHUB_WORKSPACE}/../Cli-nnections/cli-nnections_puzzles.js" - - - name: Commit and push updates + 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 pus + + - name: Commit and push CLIGames-web changes + working-directory: ../CLIGames-web run: | - set -euo pipefail - - update_repo() { - local repo_dir="$1" - local branch="${2:-}" - - if [ ! -d "${repo_dir}/.git" ]; then - echo "Skipping ${repo_dir}; not a git repository." - return - fi - - if [ -z "$(git -C "${repo_dir}" status --porcelain)" ]; then - echo "No changes in ${repo_dir}" - return - fi - - git -C "${repo_dir}" config user.name "github-actions[bot]" - git -C "${repo_dir}" config user.email "github-actions[bot]@users.noreply.github.com" - git -C "${repo_dir}" add -A - git -C "${repo_dir}" commit -m "${COMMIT_MESSAGE}" - - if [ -z "${branch}" ] || [ "${branch}" = "HEAD" ]; then - branch="$(git -C "${repo_dir}" symbolic-ref --quiet --short HEAD || true)" - fi - - if [ -z "${branch}" ]; then - echo "No branch detected for ${repo_dir}; falling back to main" - branch="main" - fi - - echo "Pushing ${repo_dir} to ${branch}" - - git -C "${repo_dir}" push origin "${branch}" - } - - update_repo "${GITHUB_WORKSPACE}" "${GITHUB_REF_NAME}" - update_repo "${GITHUB_WORKSPACE}/../CLIGames-web" - update_repo "${GITHUB_WORKSPACE}/../Wrdli" - update_repo "${GITHUB_WORKSPACE}/../Cli-nnections" + 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" || echo "No changes in CLIGames-web" + git push \ No newline at end of file