-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (39 loc) · 1.55 KB
/
package-count.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Update Package Count Badge
on:
workflow_dispatch:
push:
branches:
- main
paths:
- .github/workflows/github-releases.yml
- .github/workflows/update-via-script.yml
jobs:
update-package-count:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: pip install pyyaml
- name: Count packages
id: count
run: |
echo "countgithub=$(python3 scripts/package_count.py .github/workflows/github-releases.yml)" >> $GITHUB_OUTPUT
echo "countscript=$(python3 scripts/package_count.py .github/workflows/update-via-script.yml)" >> $GITHUB_OUTPUT
- name: Update README
run: |
countgithub=${{ steps.count.outputs.countgithub }}
countscript=${{ steps.count.outputs.countscript }}
sed -i "s/ScriptPackages-[0-9]*-green/ScriptPackages-$countscript-green/g" README.md
sed -i "s/GithubPackages-[0-9]*-blue/GithubPackages-$countgithub-blue/g" README.md
- name: Commit and push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Update package count badge
file_pattern: README.md