Project-Stats CI #6840
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: Project-Stats CI | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */4 * * *' # every 4 hours | |
repository_dispatch: | |
types: [sync-project-data] | |
env: | |
THIRD_PARTY_GIT_AUTHOR_EMAIL: [email protected] | |
THIRD_PARTY_GIT_AUTHOR_NAME: nr-opensource-bot | |
jobs: | |
job-sync-project-data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: 0 | |
token: ${{ secrets.DEVEX_OPENSOURCE_BOT_TOKEN }} | |
- name: Install dependencies | |
run: cd .github/actions/sync-data && npm install | |
- name: Sync Data | |
uses: ./.github/actions/sync-data | |
with: | |
# runs queries against GitHub API; must have push access to repos for stats queries to work | |
# this token is _only_ used for this GH action | |
github-token: ${{ secrets.OPENSOURCE_STATS_TOKEN }} | |
project-stats: true | |
- name: Commit data files | |
run: | | |
git config --local user.email "${{ env.THIRD_PARTY_GIT_AUTHOR_EMAIL }}" | |
git config --local user.name "${{ env.THIRD_PARTY_GIT_AUTHOR_NAME }}" | |
# main could have been modified since we checked out, so pull before pushing | |
git pull --ff-only origin main | |
echo "Updated project data files -- committing" | |
git add src/data | |
git commit -m "chore(stats): updated project stats files" | |
# Push to main here rather than using github-push-action | |
echo "Pushing to main" | |
git push origin main |