Skip to content

Generate Packages List from NPM #33

Generate Packages List from NPM

Generate Packages List from NPM #33

name: Generate Packages List from NPM
concurrency:
group: generate-actions
cancel-in-progress: true
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Run at midnight UTC every Sunday
permissions:
contents: write
actions: write
jobs:
generate-packages:
runs-on: ubuntu-latest
name: Generate Packages List from NPM
steps:
- name: Install Git LFS
run: |
sudo apt-get update
sudo apt-get install -y git-lfs
git lfs install
- name: Checkout code
uses: actions/checkout@v6
with:
lfs: true
- uses: oven-sh/setup-bun@v2
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24.x
- name: Install dependencies
run: bun install
- name: Generate packages list
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: bun scripts/generate_actions.mjs
- name: Check for changes
id: git-check
run: |
if git diff --quiet && git diff --cached --quiet; then
echo "changes=false" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push generated files
if: steps.git-check.outputs.changes == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git lfs track "loadedVectorStore/*.json" 2>/dev/null || true
git lfs track "loadedVectorStore/*.index" 2>/dev/null || true
git add .gitattributes 2>/dev/null || true
git add loadedVectorStore/*.json loadedVectorStore/*.index 2>/dev/null || true
git add -A
git commit -m "chore: update NPM packages list" \
-m "Automated update from generate-actions workflow" \
-m "Run ID: ${{ github.run_id }}"
# Try to pull and rebase in case of conflicts
git pull --rebase origin main || {
echo "⚠️ Rebase conflict detected, aborting and retrying..."
git rebase --abort
git pull --no-rebase origin main
exit 1
}
git push origin main
gh workflow run deploy.yml --ref main
- name: Report no changes
if: steps.git-check.outputs.changes != 'true'
run: echo "✅ No changes to commit - packages list is up to date"