Skip to content

fix: continue sponsor data fetch when one source fails#995

Open
sethamus wants to merge 2 commits intoeslint:mainfrom
sethamus:issue949
Open

fix: continue sponsor data fetch when one source fails#995
sethamus wants to merge 2 commits intoeslint:mainfrom
sethamus:issue949

Conversation

@sethamus
Copy link
Copy Markdown
Contributor

@sethamus sethamus commented Apr 9, 2026

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request?

This PR fixes the sponsor data fetch flow so a failure from one upstream source does not cause the entire fetch:sponsors script to fail.

What changes did you make? (Give an overview)

Updated tools/fetch-sponsors.js so the Open Collective, GitHub Sponsors, and thanks.dev fetches each handle their own failure during the Promise.all() call. If one source rejects, the script now logs the error and falls back to empty data for that source, allowing the rest of the sponsor data to still be written.

Related Issues

Fixes #949

Is there anything you'd like reviewers to focus on?

@github-project-automation github-project-automation bot moved this to Needs Triage in Triage Apr 9, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for new-eslint ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/new-eslint/deploys/69d8c70a01dba50007d4e676
😎 Deploy Preview https://deploy-preview-995--new-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for fr-eslint ready!

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/fr-eslint/deploys/69d8c70ac70736000800f9b0
😎 Deploy Preview https://deploy-preview-995--fr-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for ja-eslint ready!

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/ja-eslint/deploys/69d8c70a54692500097288b7
😎 Deploy Preview https://deploy-preview-995--ja-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for zh-hans-eslint ready!

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/zh-hans-eslint/deploys/69d8c70aaa4a900008f76a4e
😎 Deploy Preview https://deploy-preview-995--zh-hans-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for es-eslint ready!

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/es-eslint/deploys/69d8c70aa87427000824e85c
😎 Deploy Preview https://deploy-preview-995--es-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@eslint-github-bot eslint-github-bot bot added the bug Something isn't working label Apr 9, 2026
@eslint-github-bot eslint-github-bot bot mentioned this pull request Apr 9, 2026
3 tasks
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for de-eslint ready!

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/de-eslint/deploys/69d8c70aa0d9b5000742f9bd
😎 Deploy Preview https://deploy-preview-995--de-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for hi-eslint ready!

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/hi-eslint/deploys/69d8c70aff57980008ec3e9d
😎 Deploy Preview https://deploy-preview-995--hi-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 9, 2026

Deploy Preview for pt-br-eslint ready!

Name Link
🔨 Latest commit b06d455
🔍 Latest deploy log https://app.netlify.com/projects/pt-br-eslint/deploys/69d8c70a28fbf500084a59eb
😎 Deploy Preview https://deploy-preview-995--pt-br-eslint.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 fetch:sponsors data-fetch script to be resilient to individual upstream sponsor-source failures so that one rejected fetch doesn’t abort the entire run (addressing #949).

Changes:

  • Wrapes Open Collective, GitHub Sponsors, and thanks.dev fetches with per-promise .catch() handlers during Promise.all().
  • Logs per-source fetch failures and falls back to empty sponsor/donation data for the failing source.

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

Comment thread tools/fetch-sponsors.js
Comment on lines +478 to +491
fetchOpenCollectiveData().catch(error => {
console.error("Failed to fetch Open Collective data.", error);
return {
sponsors: [],
donations: [],
};
}),
fetchGitHubSponsors().catch(error => {
console.error("Failed to fetch GitHub Sponsors data.", error);
return {
sponsors: [],
donations: [],
};
}),
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

Catching and defaulting Open Collective / GitHub Sponsors to empty data means the daily Data Fetch workflow can succeed and then commit/push src/_data/sponsors.json + donations.json with zeros if either upstream is temporarily down. That can effectively wipe sponsor/donation data on main. Consider keeping Open Collective/GitHub failures fatal (only tolerate thanks.dev), or gate the write/commit so empty fallbacks don’t overwrite existing data unless a minimum set of sources succeeded.

Suggested change
fetchOpenCollectiveData().catch(error => {
console.error("Failed to fetch Open Collective data.", error);
return {
sponsors: [],
donations: [],
};
}),
fetchGitHubSponsors().catch(error => {
console.error("Failed to fetch GitHub Sponsors data.", error);
return {
sponsors: [],
donations: [],
};
}),
fetchOpenCollectiveData(),
fetchGitHubSponsors(),

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think Copilot’s comment is valid. I tested it locally, and for example, if the GitHub Sponsors fetch request fails for some reason, it ends up erasing all GitHub Sponsors-related information from the JSON data under src/_data.

Image

Also, in data-fetch.yml we commit that information directly to the main branch, so if an issue like #949 occurs again, the lost data could remain missing for a long time.

- name: Fetch sponsor data
run: npm run fetch:sponsors
env:
ESLINT_GITHUB_TOKEN: ${{ secrets.DATA_FETCH_TOKEN }}
- name: Generate sponsor data
run: npm run build:sponsors
- name: Setup Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<eslint@googlegroups.com>"
- name: Save updated files
run: |
chmod +x ./tools/commit-data.sh
./tools/commit-data.sh

I'm not entirely sure what the desired solution is, but at minimum I think we could preserve the existing information rather than erasing all of it.

The detailed approach for this wasn't mentioned in #949, so I'm raising it for further discussion.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I also think we should preserve the data we already have (that was previously fetched from the now-failing source).

@lumirlumir lumirlumir moved this from Needs Triage to Triaging in Triage Apr 9, 2026
@mdjermanovic mdjermanovic moved this from Triaging to Implementing in Triage Apr 9, 2026
Copy link
Copy Markdown
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this. I also agree that we should retain existing data.

In addition, we should still ideally have the CI job marked as failed after writing the file. Otherwise, we could silently be missing data for months and not know until someone logs at the logs.

@sethamus
Copy link
Copy Markdown
Contributor Author

I believe I’ve addressed all the feedback here.

Comment thread tools/fetch-sponsors.js
blockedSponsors,
] = await Promise.all([
fetchOpenCollectiveData().catch(error => {
hadSourceFetchFailure = true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of setting to true, can we make this an array where we track which data sources failed? That way we can output that info into the CI directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accepted bug Something isn't working contributor pool

Projects

Status: Implementing

Development

Successfully merging this pull request may close these issues.

Bug: data-fetch is failing

5 participants