Skip to content

test post from PR

test post from PR #1

Workflow file for this run

name: Process newly added JSON
on:
pull_request:
types: [closed]
branches:
- main
concurrency:
group: process-json-${{ github.ref }}
cancel-in-progress: true
jobs:
process-json:
# Only run if the PR was merged
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Needed to push changes back to the repo
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "yarn"
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Find newly added JSON files
id: find-json
run: |
# Get the list of added JSON files in the records/new/ directory
ADDED_FILES=$(git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} --diff-filter=A --name-only | grep '^records/new/.*\.json$')
echo "NEW_JSON_FILES=$ADDED_FILES" >> $GITHUB_ENV
- name: Process and move files
if: env.NEW_JSON_FILES
env:
BLUESKY_IDENTIFIER_PIXEL: pixel-voyager.bsky.social
BLUESKY_APP_PASSWORD_PIXEL: ${{ secrets.BLUESKY_APP_PASSWORD_PIXEL }}
run: |
for file in $NEW_JSON_FILES; do
echo "Processing $file..."
node actions/process.js "$file"
done
- name: Commit and push changes
if: env.NEW_JSON_FILES
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add records/processed/*
git commit -m "Move processed JSON files"
git push