Skip to content

Commit 1c00f3d

Browse files
committed
ci: add update used by repos stats workflow
1 parent 5f388b2 commit 1c00f3d

4 files changed

Lines changed: 64 additions & 14 deletions

File tree

.github/workflows/reusable-prepare-release.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,44 +27,44 @@ jobs:
2727
prepare-release:
2828
runs-on: ubuntu-latest
2929
steps:
30-
- name: Checkout Code
30+
- name: 📂 Checkout Code
3131
uses: actions/checkout@v4
3232
with:
3333
fetch-depth: 0
3434

35-
- name: Checkout Config
35+
- name: 🔄 Sync Changelog Config
3636
uses: actions/checkout@v4
3737
with:
3838
repository: 'leoweyr/github-release-workflow'
3939
path: .change-log-config
4040
sparse-checkout: src/cliff.toml
4141

42-
- name: Setup Node.js
42+
- name: 📦 Install Node.js
4343
uses: actions/setup-node@v4
4444
with:
4545
node-version: ${{ inputs.node-verions }}
4646

47-
- name: Set Environment Variables
47+
- name: 🛠️ Set Environment Variables
4848
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
4949

50-
- name: Create Release Branch
50+
- name: 🪾 Create Release Branch
5151
run: |
5252
git config --global user.name "${{ inputs.commit-user-name }}"
5353
git config --global user.email "${{ inputs.commit-user-email }}"
5454
git checkout -b release/${{ env.TAG_NAME }}
5555
56-
- name: Generate Changelog Content for PR Body
56+
- name: 📝 Generate Changelog Content for PR Body
5757
env:
5858
GITHUB_REPO: ${{ github.repository }}
5959
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
6060
run: |
6161
npx git-cliff --config .change-log-config/src/cliff.toml --verbose --latest --strip all > pr_body_raw.md
6262
63-
- name: Save PR Body to File
63+
- name: 📂 Save PR Body to File
6464
run: |
6565
cat pr_body_raw.md | tail -n +2 > pr_body_cleaned.md
6666
67-
- name: Update CHANGELOG.md File
67+
- name: 📝 Update Changelog File
6868
env:
6969
GITHUB_REPO: ${{ github.repository }}
7070
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
@@ -77,13 +77,13 @@ jobs:
7777
npx git-cliff --config .change-log-config/src/cliff.toml --verbose --output CHANGELOG.md
7878
fi
7979
80-
- name: Commit and Push
80+
- name: 🔄 Sync Commit and Push
8181
run: |
8282
git add CHANGELOG.md
8383
git commit -m "release: ${{ env.TAG_NAME }}"
8484
git push origin release/${{ env.TAG_NAME }}
8585
86-
- name: Create Pull Request
86+
- name: 🚀 Deploy Pull Request
8787
env:
8888
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
8989
run: |

.github/workflows/reusable-publish-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Checkout Code
15+
- name: 📂 Checkout Code
1616
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
1919

20-
- name: Extract Tag Name
20+
- name: 🔍 Verify Release Tag Name
2121
id: extract_tag
2222
run: |
2323
TITLE="${{ github.event.pull_request.title }}"
@@ -26,12 +26,12 @@ jobs:
2626
VERSION_TITLE=${TAG_NAME#v}
2727
echo "VERSION_TITLE=$VERSION_TITLE" >> $GITHUB_ENV
2828
29-
- name: Create Release Body File
29+
- name: 📝 Create Release Body File
3030
env:
3131
PR_BODY: ${{ github.event.pull_request.body }}
3232
run: echo "$PR_BODY" > release_body.md
3333

34-
- name: Create GitHub Release
34+
- name: 🚀 Deploy GitHub Release
3535
env:
3636
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
3737
run: |
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Update Used by Repos Stats
2+
3+
on:
4+
push:
5+
schedule:
6+
- cron: "47 9 * * *"
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-dependents-stats:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: 🔍 Verify Dependent Repositories in GitHub Code
14+
id: get-count
15+
env:
16+
GH_TOKEN: ${{ secrets.APP_GITHUB_TOKEN }}
17+
run: |
18+
REUSABLE_PREPARE_RELEASE='"leoweyr/github-release-workflow/.github/workflows/reusable-prepare-release.yml"'
19+
REUSABLE_PUBLISH_RELEASE='"leoweyr/github-release-workflow/.github/workflows/reusable-publish-release.yml"'
20+
21+
SEARCH_QUERY="$REUSABLE_PREPARE_RELEASE OR $REUSABLE_PUBLISH_RELEASE path:.github/workflows"
22+
23+
sleep 5
24+
25+
echo "🔍 Searching for: $SEARCH_QUERY"
26+
27+
COUNT=$(gh api -X GET search/code \
28+
-F q="$SEARCH_QUERY" \
29+
-F per_page=100 \
30+
--jq '[.items[].repository.full_name] | unique | length')
31+
32+
if [ -z "$COUNT" ] || [ "$COUNT" == "null" ]; then
33+
COUNT=0
34+
fi
35+
36+
echo "✅ Found $COUNT unique dependent repositories."
37+
38+
printf 'TOTAL_COUNT=%s\n' "$COUNT" >> "$GITHUB_ENV"
39+
40+
- name: 🔄 Sync Gist Badge Data
41+
uses: schneegans/dynamic-badges-action@v1.7.0
42+
with:
43+
auth: ${{ secrets.APP_GITHUB_TOKEN }}
44+
gistID: 0575adecfc13c95f281dfccfe5b76063
45+
filename: github-release-workflow-used-by-stats.json
46+
label: Used by
47+
message: ${{ env.TOTAL_COUNT }} repos
48+
color: "#CCA414"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
![github-release-workflow](https://socialify.git.ci/leoweyr/github-release-workflow/image?description=1&font=KoHo&forks=1&issues=1&logo=https%3A%2F%2Fraw.githubusercontent.com%2Fleoweyr%2Fgithub-release-workflow%2Frefs%2Fheads%2Fdevelop%2Fassets%2Ficon.svg&name=1&owner=1&pattern=Formal+Invitation&pulls=1&stargazers=1&theme=Light)
22

3+
![Used by Stats](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/leoweyr/0575adecfc13c95f281dfccfe5b76063/raw/github-release-workflow-used-by-stats.json)
4+
35
> [!IMPORTANT]
46
> To ensure changelogs are generated correctly, all git commit messages must follow the **[Conventional Commits](https://www.conventionalcommits.org/)** specification.
57
>

0 commit comments

Comments
 (0)