Skip to content

Commit 7e077d3

Browse files
committed
try metric action with output none and manual commit/pr
1 parent 2fcde7b commit 7e077d3

1 file changed

Lines changed: 41 additions & 1 deletion

File tree

.github/workflows/org-metrics.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,53 @@ jobs:
1414
contents: write
1515
pull-requests: write
1616
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v6
19+
with:
20+
fetch-depth: 0
21+
1722
- uses: lowlighter/metrics@latest
1823
with:
1924
token: ${{ secrets.METRICS_TOKEN }}
2025
user: OpenVoxProject
21-
output_action: pull-request
26+
output_action: none
2227
filename: profile/github-metrics.svg
2328
plugin_languages: yes
2429
plugin_followup: yes
2530
plugin_rss: yes
2631
plugin_rss_source: https://dev.to/feed/tag/voxpupuli
32+
33+
- name: Create PR with updated metrics
34+
env:
35+
GH_TOKEN: ${{ github.token }}
36+
run: |
37+
set -euo pipefail
38+
39+
git config user.name "github-actions[bot]"
40+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
41+
42+
BRANCH="automation/metrics-${{ github.run_id }}"
43+
BASE="${{ github.ref_name }}"
44+
45+
if git diff --quiet; then
46+
echo "No changes detected. Nothing to commit/PR."
47+
exit 0
48+
fi
49+
50+
git checkout -b "$BRANCH"
51+
git add profile/github-metrics.svg
52+
git commit -m "chore: update github-metrics.svg"
53+
git push -u origin "$BRANCH"
54+
55+
TITLE="chore: update github metrics"
56+
BODY="Automated update of \`profile/github-metrics.svg\`."
57+
58+
if gh pr view "$BRANCH" >/dev/null 2>&1; then
59+
echo "PR already exists for branch $BRANCH."
60+
else
61+
gh pr create \
62+
--base "$BASE" \
63+
--head "$BRANCH" \
64+
--title "$TITLE" \
65+
--body "$BODY"
66+
fi

0 commit comments

Comments
 (0)