Skip to content

Commit cf236cf

Browse files
authored
Create status.yml
1 parent 1f5e56b commit cf236cf

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/status.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Update status badge
2+
on:
3+
push: {branches: [main]}
4+
release: {types: [published, prereleased]}
5+
workflow_dispatch: {}
6+
permissions: {contents: write}
7+
jobs:
8+
badge:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Compute status
13+
env:
14+
EVENT_NAME: ${{ github.event_name }}
15+
PRERELEASE: ${{ github.event.release.prerelease }}
16+
run: |
17+
STATUS="work in process"; COLOR="yellow"
18+
if [ "$EVENT_NAME" = "release" ]; then
19+
if [ "$PRERELEASE" = "true" ]; then STATUS="beta"; COLOR="orange"
20+
else STATUS="stable"; COLOR="brightgreen"; fi
21+
fi
22+
printf '{ "schemaVersion":1,"label":"status","message":"%s","color":"%s","cacheSeconds":300 }\n' "$STATUS" "$COLOR" \
23+
> .github/status.json
24+
- name: Commit
25+
run: |
26+
git config user.email "github-actions[bot]@users.noreply.github.com"
27+
git config user.name "github-actions[bot]"
28+
git add .github/status.json
29+
git commit -m "chore: update status badge -> $(jq -r .message .github/status.json)" || exit 0
30+
git push

0 commit comments

Comments
 (0)