main #30720
This file contains 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: 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: Drop history of auto-generated files (readme.md, prs.md issues.md) | |
run: | | |
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --force --index-filter "git rm --ignore-unmatch readme.md prs.md issues.md" --prune-empty HEAD | |
- name: Use latest Node version to get access to modern features | |
uses: actions/setup-node@v3 | |
with: | |
node-version: latest | |
- name: Run the workflow script using the integration personal access token | |
run: | | |
npm install | |
node test | |
node . ${{github.token}} | |
- name: Upload JSON response artifacts for debugging in case of failure | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: debugging-artifacts | |
path: '*.artifact.json' | |
- name: Upload the followers.json cache file as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: followers.json | |
path: followers.json | |
- name: Upload the repositories.json cache file as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: repositories.json | |
path: repositories.json | |
- name: Upload the todos.json cache file as an artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: todos.json | |
path: todos.json | |
- name: Commit and force push Git changes back to the workflow repository | |
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 readme.md file | |
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 | |
# 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 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 |