-
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (53 loc) · 2.13 KB
/
byob.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Create Badge
on:
push:
branches: [main]
jobs:
create-badge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install shields.io
- name: Generate badge
run: |
import os
from shields.io import Badge
# Get license content
with open('.gitattributes') as f:
license_content = f.read()
# Create static badge
static_badge = Badge(
label="Contributions welcome",
message="Contributions welcome!",
color="green"
)
# Create dynamic badge
dynamic_badge = Badge(
label="License",
message=license_content,
color="blue"
)
# Save badges as SVG files
static_badge.save("static_badge.svg")
dynamic_badge.save("dynamic_badge.svg")
- name: Update README.md
run: |
echo "# License\n\n$(cat .gitattributes)" >> README.md
echo "\n[![Static Badge](static_badge.svg)](https://github.com/discontinuedlabs/citeease/blob/main/static_badge.svg)" >> README.md
echo "\n[![Dynamic Badge](dynamic_badge.svg)](https://github.com/discontinuedlabs/citeease/blob/main/dynamic_badge.svg)" >> README.md
- name: Commit changes
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update README with badge"
git push