Skip to content

Refactor fetch-x-feed workflow for error handling - #73

Merged
BreadMotion merged 1 commit into
developfrom
BreadMotion-patch-3
Sep 16, 2026
Merged

BreadMotion merged 1 commit into
developfrom
BreadMotion-patch-3

Conversation

@BreadMotion

Copy link
Copy Markdown
Owner

No description provided.

Signed-off-by: パン君 <yamazakimotionpg@gmail.com>
@BreadMotion BreadMotion self-assigned this Sep 16, 2026
Copilot AI lite review requested due to automatic review settings September 16, 2026 05:36
@BreadMotion
BreadMotion merged commit 9a38874 into develop Sep 16, 2026

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.

🟡 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_feed helper to generate/commit/push an empty feed when API requests fail or are misconfigured.
  • Switches X API calls to curl --fail-with-body with guarded parsing and “empty feed” fallbacks.
  • Makes git push best-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-time to 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
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