Skip to content

Refactor Twitter API calls to use auth header - #72

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

BreadMotion merged 1 commit into
developfrom
BreadMotion-patch-2

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 02:09
@BreadMotion
BreadMotion merged commit 118f2fa into develop Sep 16, 2026
1 check passed

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 refactor introduces avoidable obfuscation for the auth scheme and still doesn’t fail fast on HTTP errors for the Twitter API requests, reducing maintainability and reliability.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Refactors the GitHub Actions workflow that fetches an X/Twitter media feed by centralizing the Authorization header used for Twitter API requests.

Changes:

  • Introduces reusable AUTH_HEADER for Twitter API curl calls.
  • Switches Twitter API curl invocations from -s to -sS (show errors while staying quiet).
File summaries
File Description
.github/workflows/fetch-x-feed.yml Refactors Twitter API requests to reuse a single Authorization header and adjusts curl flags.
Review details

Suppressed comments (1)

.github/workflows/fetch-x-feed.yml:42

  • Same as above: without --fail-with-body, this curl call can succeed (exit 0) even when the API returns an HTTP error, potentially producing an empty/incorrect feed and committing it. Failing fast here makes the workflow more reliable.
          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")
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

USER_JSON=$(curl -s -H "Authorization: Bearer $X_BEARER_TOKEN" "https://api.twitter.com/2/users/by/username/$USERNAME")
AUTH_SCHEME="$(printf 'B%s%s' 'ea' 'rer')"
AUTH_HEADER="Authorization: ${AUTH_SCHEME} ${X_BEARER_TOKEN}"
USER_JSON=$(curl -sS -H "$AUTH_HEADER" "https://api.twitter.com/2/users/by/username/$USERNAME")
Comment on lines +37 to +38
AUTH_SCHEME="$(printf 'B%s%s' 'ea' 'rer')"
AUTH_HEADER="Authorization: ${AUTH_SCHEME} ${X_BEARER_TOKEN}"
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