|
1 | 1 | name: 🔄 Update README with Onefetch |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | 4 | branches: |
|
8 | 7 | schedule: |
9 | 8 | - cron: "0 0 * * 0" |
10 | 9 | workflow_dispatch: |
11 | | - |
12 | 10 | permissions: |
13 | 11 | contents: write |
14 | | - |
15 | 12 | jobs: |
16 | 13 | update-readme: |
17 | 14 | name: Gerar Onefetch e atualizar README |
18 | 15 | runs-on: ubuntu-latest |
19 | | - |
20 | 16 | steps: |
21 | | - - name: 📥 Checkout do repositório |
22 | | - uses: actions/checkout@v4 |
23 | | - with: |
24 | | - fetch-depth: 0 |
25 | | - |
26 | | - - name: 🦀 Instalar Onefetch |
27 | | - run: | |
28 | | - VERSION=$(curl -sI https://github.com/o2sh/onefetch/releases/latest \ |
29 | | - | grep -i location | sed 's|.*/tag/||' | tr -d '[:space:]') |
30 | | - echo "Versão detectada: $VERSION" |
31 | | - curl -sL "https://github.com/o2sh/onefetch/releases/download/${VERSION}/onefetch_amd64.deb" \ |
32 | | - -o onefetch.deb |
33 | | - sudo dpkg -i onefetch.deb |
34 | | - onefetch --version |
35 | | -
|
36 | | - - name: 🧊 Instalar ansisvg |
37 | | - run: | |
38 | | - curl -sL "https://github.com/nicowillis/ansisvg/releases/latest/download/ansisvg-linux-amd64" \ |
39 | | - -o ansisvg |
40 | | - chmod +x ansisvg |
41 | | - sudo mv ansisvg /usr/local/bin/ansisvg |
42 | | -
|
43 | | - - name: 🎨 Gerar SVG com onefetch + console2svg |
44 | | - run: | |
45 | | - npm install -g console2svg |
46 | | - console2svg -o onefetch.svg -- onefetch -d pending |
47 | | - # Adiciona bordas arredondadas ao rect de fundo |
48 | | - sed -i 's/\(<rect[^>]*\)\/>/\1 rx="12" ry="12"\/>/' onefetch.svg |
49 | | -
|
50 | | - - name: 📝 Atualizar README.md |
51 | | - run: | |
52 | | - python3 << 'EOF' |
53 | | - import re |
54 | | - try: |
55 | | - with open("README.md", "r", encoding="utf-8") as f: |
56 | | - readme = f.read() |
57 | | - except FileNotFoundError: |
58 | | - readme = "" |
59 | | -
|
60 | | - new_block = "<!-- ONEFETCH_START -->\n\n<!-- ONEFETCH_END -->" |
61 | | - pattern = r"<!-- ONEFETCH_START -->.*?<!-- ONEFETCH_END -->" |
62 | | -
|
63 | | - if re.search(pattern, readme, re.DOTALL): |
64 | | - updated = re.sub(pattern, new_block, readme, flags=re.DOTALL) |
65 | | - else: |
66 | | - updated = readme.rstrip() + "\n\n" + new_block + "\n" |
67 | | -
|
68 | | - with open("README.md", "w", encoding="utf-8") as f: |
69 | | - f.write(updated) |
70 | | - print("README.md atualizado!") |
71 | | - EOF |
72 | | -
|
73 | | - - name: 🔍 Verificar mudanças |
74 | | - id: check_changes |
75 | | - run: | |
76 | | - if git diff --quiet README.md onefetch.svg; then |
77 | | - echo "changed=false" >> $GITHUB_OUTPUT |
78 | | - else |
79 | | - echo "changed=true" >> $GITHUB_OUTPUT |
80 | | - fi |
| 17 | + - uses: actions/checkout@v4 |
81 | 18 |
|
82 | | - - name: 💾 Commit e Push |
83 | | - if: steps.check_changes.outputs.changed == 'true' |
84 | | - run: | |
85 | | - git config --local user.email "github-actions[bot]@users.noreply.github.com" |
86 | | - git config --local user.name "github-actions[bot]" |
87 | | - git add README.md onefetch.svg |
88 | | - git commit -m "docs: atualiza estatísticas do repo via onefetch [skip ci]" |
89 | | - git push |
| 19 | + - name: Fetch-Docs-CLI |
| 20 | + uses: miojo-dev/Fetch-Docs-CLI@v1.0.2-language_fix |
0 commit comments