Skip to content

main

main #38417

Workflow file for this run

name: main
on:
push:
workflow_dispatch:
schedule:
- cron: "0 * * * *"
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Check out the source code
uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
- name: Install Bun
uses: oven-sh/setup-bun@v2
- name: Drop prior auto-generated commits to keep repository history clean
run: |
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --force --commit-filter '[ "$GIT_AUTHOR_NAME" = "github-actions[bot]" ] && skip_commit "$@" || git commit-tree "$@"' HEAD
- name: Run the workflow script using the integration personal access token
run: |
if ! bun install; then
echo "Transient error, skipping this run"
echo "INSTALL_FAILURE=1" >> "$GITHUB_ENV"
exit 0
fi
bun . ${{github.token}}
- name: Upload JSON response artifacts for debugging in case of failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: debugging-artifacts
path: "*.artifact.json"
- name: Upload the followers.json cache file as an artifact
if: env.INSTALL_FAILURE != '1' && env.API_FAILURE != '1'
uses: actions/upload-artifact@v4
with:
name: followers.json
path: followers.json
- name: Upload the repositories.json cache file as an artifact
if: env.INSTALL_FAILURE != '1' && env.API_FAILURE != '1'
uses: actions/upload-artifact@v4
with:
name: repositories.json
path: repositories.json
- name: Upload the todos.json cache file as an artifact
if: env.INSTALL_FAILURE != '1' && env.API_FAILURE != '1'
uses: actions/upload-artifact@v4
with:
name: todos.json
path: todos.json
- name: Stage and commit the changes made by the script to Git
if: env.INSTALL_FAILURE != '1' && env.API_FAILURE != '1'
run: |
set -e
set -x
# Configure Git for the push from the workflow to the repository
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Stage the Git index change of the auto-generated files
# Note that followers.json+repositories.json+todos.json are artifacts
git add readme.md prs.md issues.md
git add by-name-asc.md by-name-desc.md
git add by-pushed_at-asc.md by-pushed_at-desc.md
git add by-size-asc.md by-size-desc.md
git add by-updated_at-asc.md by-updated_at-desc.md
if [ -e identical-forks.md ]; then
git add identical-forks.md
fi
# Bail if there are no changes to commit and hence no GitHub Pages to build
if git diff-index --quiet HEAD --; then
exit
fi
# Commit the staged history-less changes to the workflow repository
git commit -m "Generate the profile repository readme" -m "This commit was automatically generated via GitHub Actions"
# Push the commit to the workflow repository using force since we rewrote history
git push origin HEAD:main --force