Skip to content

Metrics

Metrics #61

Workflow file for this run

name: Metrics
on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch:
jobs:
github-metrics:
runs-on: ubuntu-latest
environment:
name: production
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: lowlighter/metrics@latest
with:
token: ${{ secrets.METRICS_TOKEN }}
user: OpenVoxProject
output_action: none
filename: profile/github-metrics.svg
plugin_languages: yes
plugin_followup: yes
plugin_rss: yes
plugin_rss_source: https://dev.to/feed/tag/voxpupuli
- name: Create PR with updated metrics
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
BRANCH="automation/metrics-${{ github.run_id }}"
BASE="${{ github.ref_name }}"
if git diff --quiet; then
echo "No changes detected. Nothing to commit/PR."
exit 0
fi
git checkout -b "$BRANCH"
git add profile/github-metrics.svg
git commit -m "chore: update github-metrics.svg"
git push -u origin "$BRANCH"
TITLE="chore: update github metrics"
BODY="Automated update of \`profile/github-metrics.svg\`."
if gh pr view "$BRANCH" >/dev/null 2>&1; then
echo "PR already exists for branch $BRANCH."
else
gh pr create \
--base "$BASE" \
--head "$BRANCH" \
--title "$TITLE" \
--body "$BODY"
fi