Daily Collect and Report #37
This file contains hidden or 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: Daily Collect and Report | |
on: | |
schedule: | |
- cron: '0 0 * * *' # every day at midnight UTC | |
workflow_dispatch: | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
pages: write | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.24' | |
cache: 'true' | |
- name: Build | |
run: go build -o app | |
- name: Authenticate Via OIDC Role | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-east-1 | |
role-duration-seconds: "1800" | |
role-skip-session-tagging: true | |
role-to-assume: ${{ vars.AWS_ROLE_ARN }} | |
mask-aws-account-id: true | |
- name: Collect data | |
run: ./app collect | |
env: | |
LAMBDA_ROLE_ARN: ${{ vars.LAMBDA_ROLE_ARN }} | |
- name: Commit results.json if changed | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
if [[ -n $(git status --porcelain results.json) ]]; then | |
git add results.json | |
git commit -m "Update results.json [auto]" | |
git push | |
fi | |
- name: Run report | |
run: | | |
mkdir -p _site | |
./app report _site/index.html | |
- name: Upload report.html as GitHub Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} |