Skip to content

Commit 8c1914e

Browse files
authored
Update workflow files changed (#24)
1 parent ef761a2 commit 8c1914e

File tree

3 files changed

+143
-26
lines changed

3 files changed

+143
-26
lines changed

.github/workflows/files-changed.yml

+38-1
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,55 @@ on:
1717
types:
1818
- completed
1919

20+
permissions:
21+
# Needs to write to this repo
22+
contents: write
23+
24+
concurrency:
25+
group: ${{ github.ref }}
26+
cancel-in-progress: true
27+
2028
jobs:
2129
notify:
2230
runs-on: ubuntu-latest
2331
steps:
2432
- name: Checkout code
2533
uses: actions/checkout@v4
2634
with:
27-
fetch-depth: 5
35+
fetch-depth: 3
2836
ref: master
2937

3038
- name: Get changes and send webhook to COPR
3139
shell: bash
3240
env:
3341
WEBHOOK: ${{ secrets.WEBHOOK_URL }}
3442
run: ./scripts/copr_webhook.sh $WEBHOOK ${{ github.sha }}
43+
44+
update-readme:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Set up Python
51+
uses: actions/setup-python@v5
52+
with:
53+
python-version: "3.12"
54+
55+
- name: Install dependencies
56+
run: |
57+
python -m pip install --upgrade pip
58+
pip install markdown
59+
60+
- name: Update README.md file
61+
run: python scripts/python_create_readme.py
62+
63+
- name: Commit and push changes
64+
run: |
65+
git config --global user.name 'github-actions[bot]'
66+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
67+
git add README.md
68+
git commit -m 'Auto update README.md'
69+
git push
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

+39-25
Original file line numberDiff line numberDiff line change
@@ -9,65 +9,79 @@ For any issues or questions related to python scripts, please go to upstream rep
99
### atuin
1010

1111
![atuin status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/atuin/status_image/last_build.png)
12-
1312
[Upstream](https://github.com/atuinsh/atuin)
1413

1514
### bottom
1615

1716
![bottom status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/bottom/status_image/last_build.png)
18-
1917
[Upstream](https://github.com/ClementTsang/bottom)
2018

19+
### chezmoi
20+
21+
![chezmoi status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/chezmoi/status_image/last_build.png)
22+
[Upstream](https://github.com/twpayne/chezmoi)
23+
2124
### fnm
2225

2326
![fnm status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/fnm/status_image/last_build.png)
24-
2527
[Upstream](https://github.com/Schniz/fnm)
2628

27-
### mise
29+
### jj
2830

29-
![mise status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/mise/status_image/last_build.png)
31+
![jj status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/jj/status_image/last_build.png)
32+
[Upstream](https://github.com/martinvonz/jj)
3033

31-
[Upstream](https://github.com/jdx/mise)
34+
### kubie
3235

33-
### rust-tealdeer
36+
![kubie status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/kubie/status_image/last_build.png)
37+
[Upstream](https://github.com/sbstp/kubie)
3438

35-
![rust-tealdeer status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/rust-tealdeer/status_image/last_build.png)
39+
### lazydocker
3640

37-
[Upstream](https://crates.io/crates/tealdeer)
41+
![lazydocker status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/lazydocker/status_image/last_build.png)
42+
[Upstream](https://github.com/jesseduffield/lazydocker)
43+
44+
### lazygit
45+
46+
![lazygit status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/lazygit/status_image/last_build.png)
47+
[Upstream](https://github.com/jesseduffield/lazygit)
48+
49+
### lazyjj
50+
51+
![lazyjj status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/lazyjj/status_image/last_build.png)
52+
[Upstream](https://github.com/Cretezy/lazyjj)
53+
54+
### lazynpm
55+
56+
![lazynpm status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/lazynpm/status_image/last_build.png)
57+
[Upstream](https://github.com/jesseduffield/lazynpm)
58+
59+
### mise
60+
61+
![mise status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/mise/status_image/last_build.png)
62+
[Upstream](https://github.com/jdx/mise)
3863

3964
### starship
4065

4166
![starship status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/starship/status_image/last_build.png)
42-
4367
[Upstream](https://github.com/starship/starship)
4468

69+
### superfile
70+
71+
![superfile status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/superfile/status_image/last_build.png)
72+
[Upstream](https://github.com/yorukot/superfile)
73+
4574
### usage
4675

4776
![usage status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/usage/status_image/last_build.png)
48-
4977
[Upstream](https://github.com/jdx/usage)
5078

5179
### uv
5280

5381
![uv status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/uv/status_image/last_build.png)
54-
5582
[Upstream](https://github.com/astral-sh/uv)
5683

57-
### wezterm
58-
59-
![wezterm status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/wezterm/status_image/last_build.png)
60-
61-
[Upstream](https://github.com/wez/wezterm)
62-
6384
### zellij
6485

6586
![zellij status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/zellij/status_image/last_build.png)
66-
6787
[Upstream](https://github.com/zellij-org/zellij)
68-
69-
### zenith
70-
71-
![zenith status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/zenith/status_image/last_build.png)
72-
73-
[Upstream](https://github.com/bvaisvil/zenith/)

scripts/python_create_readme.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/env python3
2+
3+
import pathlib
4+
import markdown
5+
6+
# Specify the directory path
7+
dir_path = pathlib.Path('.')
8+
9+
# Use glob to retrieve a list of files
10+
files = dir_path.glob('specs/**/*.spec') # only match .spec files
11+
12+
# Sort the files by filename (natural sort)
13+
sorted_files = sorted(files, key=lambda x: x.name)
14+
15+
# Array to store the name and URL pairs
16+
name_url_pairs = []
17+
18+
# Process files and extract Name and URL
19+
for file in sorted_files:
20+
name = None
21+
url = None
22+
with file.open("r", encoding="utf-8") as spec_file:
23+
for line in spec_file:
24+
if line.startswith("Name:"):
25+
name = line.split(":", 1)[1].strip()
26+
elif line.startswith("URL:"):
27+
url = line.split(":", 1)[1].strip()
28+
# Break the loop if both Name and URL are found
29+
if name and url:
30+
break
31+
if name and url:
32+
name_url_pairs.append((name, url))
33+
print(f'Processed: {file.name} -> Name: {name}, URL: {url}')
34+
35+
# Create markdown content for README.md
36+
readme_content = """# Autocopr forked repo
37+
38+
For any issues or questions related to python scripts, please go to upstream repo.
39+
40+
<details open>
41+
42+
<summary>Status badges on COPR builds</summary>
43+
"""
44+
45+
for name, url in name_url_pairs:
46+
readme_content += f"""
47+
### {name}
48+
49+
![{name} status](https://copr.fedorainfracloud.org/coprs/relativesure/all-packages/package/{name}/status_image/last_build.png)
50+
[Upstream]({url})
51+
"""
52+
53+
# Example of how to convert markdown content to HTML (optional, for further use)
54+
#html_content = markdown.markdown(markdown_content)
55+
56+
# Write markdown content to README.md
57+
readme_path = pathlib.Path("README.md")
58+
with readme_path.open("w", encoding="utf-8") as readme_file:
59+
readme_file.write(readme_content)
60+
61+
print("README.md file created successfully!")
62+
63+
# Example of how to use the html_content (optional)
64+
# with open("README.html", "w", encoding="utf-8") as html_file:
65+
# html_file.write(html_content)
66+

0 commit comments

Comments
 (0)