Update Index #146
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
name: Update Index | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
discover: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.BOT_GH_TOKEN }} | |
- name: Install Bun | |
uses: oven-sh/setup-bun@v2 | |
- name: Install Packages | |
run: bun i | |
- name: Run Index Job | |
run: bun start | |
working-directory: 'scripts/sync' | |
env: | |
GITHUB_TOKEN: ${{ secrets.INDEX_GH_TOKEN }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
- name: Commit and Push Changes | |
run: | | |
git config user.name "metorial[bot]" | |
git config user.email "[email protected]" | |
git add . | |
if git diff --cached --quiet; then | |
echo "No changes to commit." | |
else | |
git commit -m "Update index" | |
git push | |
fi | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: 'latest' | |
files: | | |
index.db | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Debug - Check for changes | |
run: | | |
echo "=== Git Status ===" | |
git status | |
echo "" | |
echo "=== Changed files ===" | |
git diff --name-only | |
echo "" | |
echo "=== Untracked files ===" | |
git ls-files --others --exclude-standard | |
echo "" | |
echo "=== All changes ===" | |
git status --porcelain | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: Update catalog | |
branch: update-catalog-${{ github.run_id }} | |
delete-branch: true | |
title: 'chore: Update catalog' | |
body: | | |
Automated container version updates discovered by the version checker. | |
committer: metorial[bot] <[email protected]> | |
author: metorial[bot] <[email protected]> | |
add-paths: | | |
. | |
- name: Enable Auto-merge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Output PR Info | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
run: | | |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | |
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |