Repository navigation
Add workflow to fetch X media feed - #71
Merged
Merged
Conversation
Signed-off-by: パン君 <yamazakimotionpg@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
The workflow currently makes unnecessary network calls (risking rate limits) and writes the generated JSON outside the repo’s established WebSite/assets/data convention for generated data files.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds a scheduled/manual GitHub Actions workflow that fetches recent media-related posts from X (via Twitter API + oEmbed) and commits a JSON artifact into the website assets so the site can consume a lightweight “X media feed” payload.
Changes:
- Introduces a new scheduled +
workflow_dispatchworkflow to fetch a user’s recent tweets and build anx-feed.jsonfile. - Uses the
X_BEARER_TOKENsecret to call the Twitter v2 API and publish.twitter.com oEmbed, then commits/pushes the resulting JSON.
File summaries
| File | Description |
|---|---|
| .github/workflows/fetch-x-feed.yml | New automation to fetch X media/oEmbed data and commit a generated JSON file into the site’s assets. |
Review details
- 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.
Comment on lines
+41
to
+52
| IDS=$(echo "$TWEETS_JSON" | jq -r '.data[]? | select(.attachments != null) | .id' || true) | ||
| if [ -z "$IDS" ]; then | ||
| IDS=$(echo "$TWEETS_JSON" | jq -r '.data[]? | select(.text | test("pic\\.twitter\\.com")) | .id' || true) | ||
| fi | ||
| OUTPUT='[]' | ||
| for id in $IDS; do | ||
| URL="https://x.com/$USERNAME/status/$id" | ||
| OEMBED_JSON=$(curl -s "https://publish.twitter.com/oembed?url=$URL&dnt=true") | ||
| OEMBED_HTML=$(echo "$OEMBED_JSON" | jq -r '.html // empty') | ||
| OUTPUT=$(echo "$OUTPUT" | jq --arg url "$URL" --arg html "$OEMBED_HTML" '. + [ { url: $url, oembed_html: $html } ]') | ||
| done | ||
| OUTPUT=$(echo "$OUTPUT" | jq '.[0:3]') || OUTPUT='[]' |
Comment on lines
+53
to
+57
| mkdir -p WebSite/assets | ||
| echo "$OUTPUT" > WebSite/assets/x-feed.json | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add WebSite/assets/x-feed.json |
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.