Skip to content

Fix populate script workflow and add error handling#6

Merged
28pins merged 3 commits into
mainfrom
copilot/fix-populate-script-errors
May 25, 2026
Merged

Fix populate script workflow and add error handling#6
28pins merged 3 commits into
mainfrom
copilot/fix-populate-script-errors

Conversation

Copilot AI commented May 25, 2026

Copy link
Copy Markdown
Contributor
  • Fix workflow typo: git pus -> git push
  • Fix workflow working directory issue
  • Add error handling to populate script for excessive failures (>10 dates)
  • Add retry logic to workflow with two attempts
  • Add email notification step on workflow failure
  • Extract FAILURE_THRESHOLD to constant for maintainability
  • Ensure consistent error messages between console.error and thrown errors
  • Update Node.js version requirement message for clarity
  • Use Promise.allSettled() to allow both functions to complete before checking results
  • Validation complete - PR Fix populate script workflow and add error handling #6 created

@28pins 28pins marked this pull request as ready for review May 25, 2026 20:47
Copilot AI review requested due to automatic review settings May 25, 2026 20:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the scheduled “daily words & puzzles” population automation by improving workflow robustness (retry + notification) and tightening the populate script’s failure handling so the workflow can fail fast when upstream fetching is consistently broken.

Changes:

  • Add a failure threshold and error propagation in scripts/populate_dailyWords.js, and coordinate both Wordle + Connections runs via Promise.allSettled().
  • Fix and harden the GitHub Actions workflow by adding a 2-attempt retry, unified commit/push, and an email notification step on failure.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
scripts/populate_dailyWords.js Adds failure threshold checks + consolidated top-level execution/exit behavior for Wordle and Connections population.
.github/workflows/update-daily-words.yml Adds retry logic, fixes execution flow, commits once, and sends an email on job failure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +175 to +177
// Run both functions and check results. Allow both to complete even if one fails.
Promise.allSettled([main(), mainConnections()])
.then(results => {
Comment on lines +71 to +73
console.error(`\nERROR: ${failedDates.length} dates failed to fetch Wordle solutions (threshold: ${FAILURE_THRESHOLD})`);
console.error(`Failed dates: ${failedDates.slice(0, 20).join(', ')}${failedDates.length > 20 ? '...' : ''}`);
throw new Error(`Wordle fetch failed for ${failedDates.length} dates`);
Comment on lines +149 to +151
console.error(`ERROR: ${failed.length} Connections dates failed to fetch (threshold: ${FAILURE_THRESHOLD})`);
console.error(`Failed dates: ${failed.slice(0, 20).join(', ')}${failed.length > 20 ? '...' : ''}`);
throw new Error(`Connections fetch failed for ${failed.length} dates`);
Comment on lines +54 to +57
- name: Notify on failure
if: failure()
uses: dawidd6/action-send-mail@v3
with:
@28pins 28pins merged commit dc89406 into main May 25, 2026
1 check passed
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.

3 participants