Repository navigation
Refactor fetch-x-feed workflow for error handling - #73
Merged
Merged
Conversation
Signed-off-by: パン君 <yamazakimotionpg@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
The workflow now risks silently succeeding despite unexpected command failures and has a misleading “no-op” message while still committing/pushing changes.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Refactors the fetch-x-feed GitHub Actions workflow to make X API failures non-fatal by writing an empty x-feed.json and completing the run successfully, instead of failing the job.
Changes:
- Adds a
write_empty_feedhelper to generate/commit/push an empty feed when API requests fail or are misconfigured. - Switches X API calls to
curl --fail-with-bodywith guarded parsing and “empty feed” fallbacks. - Makes
git pushbest-effort (non-fatal) with a warning message.
File summaries
| File | Description |
|---|---|
| .github/workflows/fetch-x-feed.yml | Updates workflow scripting to handle X API errors by writing an empty feed and avoiding job failures. |
Review details
Suppressed comments (1)
.github/workflows/fetch-x-feed.yml:62
- The tweets API call has no timeout; add
--max-timeto avoid long hangs on transient network issues.
TWEETS_JSON=$(curl --silent --show-error --fail-with-body -H "$AUTH_HEADER" "https://api.twitter.com/2/users/$USER_ID/tweets?max_results=100&expansions=attachments.media_keys&tweet.fields=created_at,text" || true)
- Files reviewed: 1/1 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| X_BEARER_TOKEN: ${{ secrets.X_BEARER_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| set -u |
| TWEETS_JSON=$(curl -sS -H "$AUTH_HEADER" "https://api.twitter.com/2/users/$USER_ID/tweets?max_results=100&expansions=attachments.media_keys&tweet.fields=created_at,text") | ||
| AUTH_HEADER="Authorization: Bearer ${X_BEARER_TOKEN}" | ||
|
|
||
| USER_JSON=$(curl --silent --show-error --fail-with-body -H "$AUTH_HEADER" "https://api.twitter.com/2/users/by/username/$USERNAME" || true) |
Comment on lines
41
to
+43
| if [ -z "${X_BEARER_TOKEN:-}" ]; then | ||
| echo "X_BEARER_TOKEN secret is not set. Exiting (no-op)." | ||
| write_empty_feed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.