Repository navigation
Refactor Twitter API calls to use auth header - #72
Merged
Merged
Conversation
Signed-off-by: パン君 <yamazakimotionpg@gmail.com>
There was a problem hiding this comment.
🟡 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_HEADERfor Twitter APIcurlcalls. - Switches Twitter API
curlinvocations from-sto-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, thiscurlcall 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}" |
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.