Skip to content

Add workflow to fetch X media feed - #71

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

BreadMotion merged 1 commit into
developfrom
BreadMotion-patch-1

Conversation

@BreadMotion

Copy link
Copy Markdown
Owner

No description provided.

Signed-off-by: パン君 <yamazakimotionpg@gmail.com>
@BreadMotion BreadMotion self-assigned this Sep 14, 2026
Copilot AI lite review requested due to automatic review settings September 14, 2026 15:27
@BreadMotion
BreadMotion merged commit 68f8140 into develop Sep 14, 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 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_dispatch workflow to fetch a user’s recent tweets and build an x-feed.json file.
  • Uses the X_BEARER_TOKEN secret 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
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