|
| 1 | +name: Generate Instance Main |
| 2 | +on: |
| 3 | + # A new interval every Sunday. |
| 4 | + schedule: |
| 5 | + - cron: 5 0 * * 0 # 00:05 UTC, 16:05 PST |
| 6 | + # Adds a button to manually trigger |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + generate-instance-main: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + with: |
| 15 | + token: ${{ secrets.ADMIN_TOKEN }} |
| 16 | + |
| 17 | + - name: Install Packages 🔧 |
| 18 | + run: | |
| 19 | + yarn --frozen-lockfile |
| 20 | +
|
| 21 | + - name: Load Data and Compute Cred 🧮 |
| 22 | + run: yarn sourcecred go |
| 23 | + env: |
| 24 | + SOURCECRED_GITHUB_TOKEN: ${{ secrets.SOURCECRED_GITHUB_TOKEN }} |
| 25 | + SOURCECRED_DISCORD_TOKEN: ${{ secrets.SOURCECRED_DISCORD_TOKEN }} |
| 26 | + |
| 27 | + - name: Set environment variables |
| 28 | + id: details |
| 29 | + run: | |
| 30 | + echo "COMMIT_TITLE=Scheduled aliases update for week ending $(date +"%B %dth, %Y")" >> $GITHUB_ENV |
| 31 | + description="This commit was auto-generated on $(date +%d-%m-%Y) |
| 32 | + to add the latest aliases to our instance." |
| 33 | + description="${description//'%'/'%25'}" |
| 34 | + description="${description//$'\n'/'%0A'}" |
| 35 | + description="${description//$'\r'/'%0D'}" |
| 36 | + echo "::set-output name=commit_body::$description" |
| 37 | +
|
| 38 | + - name: Commit ledger changes |
| 39 | + run: | |
| 40 | + git config user.name 'credbot' |
| 41 | + git config user.email 'credbot@users.noreply.github.com' |
| 42 | + git add data/ledger.json |
| 43 | + git add config |
| 44 | + git commit --allow-empty -m '${{ env.COMMIT_TITLE }}' -m '${{ steps.details.outputs.commit_body }}' |
| 45 | +
|
| 46 | + - name: Push Ledger |
| 47 | + run: git push |
0 commit comments