π GitHub Actions usage report #112
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: π GitHub Actions usage report | |
on: | |
workflow_dispatch: | |
schedule: | |
# Runs at 00:40 UTC on the first of every week (Monday) | |
# | |
# ββββββββββββββββ minute | |
# β βββββββββββββ hour | |
# β β βββββββββββ day (month) | |
# β β β βββββββββ month | |
# β β β β βββββββ day (week) | |
- cron: '40 0 * * 1' | |
jobs: | |
org: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.APP_ID }} | |
private-key: ${{ secrets.PRIVATE_KEY }} | |
- name: run actions export | |
run: | | |
npm install @stoe/action-reporting-cli --global | |
npx @stoe/action-reporting-cli --owner ${{ env.ORG }} --uses --csv actions-output.csv --md actions-output.md --json actions-output.json | |
env: | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
ORG: ${{ github.repository_owner }} | |
- name: output csv | |
run: | | |
cat actions-output.csv | |
- name: output json | |
run: | | |
jq . < actions-output.json > actions-output-pretty.json | |
mv -f actions-output-pretty.json actions-output.json | |
cat actions-output.json | |
- name: output md | |
run: | | |
cat actions-output.md | |
# redirect to job summary | |
- name: upload job summary | |
run: | | |
echo "# ππ Actions Report for org - markdown" >> $GITHUB_STEP_SUMMARY | |
cat actions-output.md >> $GITHUB_STEP_SUMMARY | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: output | |
path: actions-* | |
- name: push to git repo | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add actions-output.csv actions-output.json actions-output.md | |
git commit -m "updating organization actions reports" | |
git push |