Automatically count plugins (#93)
* Awesome Bot will only run manually and on cron * Ruby script and workflow to count plugins and update README.md on `push` and manually
This commit is contained in:
parent
b39abc9e15
commit
8f799e3a87
4 changed files with 68 additions and 5 deletions
27
.github/scripts/parse.rb
vendored
Normal file
27
.github/scripts/parse.rb
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
# Open README.md
|
||||
readme = 'README.md'
|
||||
content = File.read(readme)
|
||||
|
||||
# Remove everything before `## Plugins` and after `## Themes`
|
||||
# Count all the `- [` at the beginning of lines
|
||||
count = content
|
||||
.gsub(/^[.\s\S\r\n]*## Plugins/, '')
|
||||
.gsub!(/## Themes[.\s\S\r\n]*$/, '')
|
||||
.scan(/^-\s+\[/m).size
|
||||
|
||||
if count.to_i > 100
|
||||
print "#{count} plugins found, "
|
||||
|
||||
# Update <!--plugin_count-->???<!--/plugin_count--> placeholders in readme and update file
|
||||
content.gsub!(/<!--plugin_count-->\d*?<!--\/plugin_count-->/, "<!--plugin_count-->#{count}<!--/plugin_count-->")
|
||||
File.open(readme, "w") {|file| file.puts content }
|
||||
puts "#{readme} updated."
|
||||
exit(true)
|
||||
|
||||
else
|
||||
puts "error (found #{count} plugins)"
|
||||
exit(false)
|
||||
|
||||
end
|
31
.github/workflows/build.yml
vendored
Normal file
31
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: Update plugin count
|
||||
|
||||
on:
|
||||
#pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'README.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.0
|
||||
- name: Update README
|
||||
run: ruby .github/scripts/parse.rb
|
||||
- name: Commit and push if README changed
|
||||
run: |-
|
||||
git diff
|
||||
git config user.name "Awesome YOURLS Robot"
|
||||
git config user.email "yourls@users.noreply.github.com"
|
||||
git add -A
|
||||
git commit -m "Update plugin count" || exit 0
|
||||
git push
|
||||
|
5
.github/workflows/check-links.yml
vendored
5
.github/workflows/check-links.yml
vendored
|
@ -1,13 +1,12 @@
|
|||
name: Check links
|
||||
|
||||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 12 */7 * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
@ -18,7 +17,7 @@ jobs:
|
|||
- name: Install Awesome Bot
|
||||
run: gem install awesome_bot
|
||||
- name: Run Awesome Bot
|
||||
run: awesome_bot README.md --request-delay 1 --allow-timeout -t 5 --allow-dupe --white-list sho.rt,your.site,long.url,awesome.re
|
||||
run: awesome_bot README.md --request-delay 1 --allow-ssl --allow-timeout -t 5 --allow-dupe --white-list sho.rt,your.site,long.url,awesome.re
|
||||
- uses: actions/upload-artifact@v2.2.3
|
||||
if: failure()
|
||||
with:
|
||||
|
|
10
README.md
10
README.md
|
@ -1,11 +1,12 @@
|
|||
# Awesome YOURLS [![Awesome](https://awesome.re/badge.svg)](https://awesome.re) [<img src="https://github.com/YOURLS/YOURLS/raw/master/images/yourls-logo.svg" alt="YOURLS Logo" align="right" height="120">](https://github.com/YOURLS/awesome-yourls/)
|
||||
# Awesome YOURLS [![Awesome](https://awesome.re/badge.svg)](https://awesome.re) [<img src="https://github.com/YOURLS/YOURLS/raw/master/images/yourls-logo.svg" alt="YOURLS Logo" align="right" height="120">](https://github.com/YOURLS/awesome-yourls/) [![Listed in Awesome YOURLS!](https://img.shields.io/badge/Awesome-YOURLS-C5A3BE)](https://github.com/YOURLS/awesome-yourls/)
|
||||
|
||||
> A curated list of **awesome things** related to **[YOURLS](https://github.com/YOURLS/YOURLS)**
|
||||
|
||||
## Contents
|
||||
|
||||
- [Official Links](#official-links-) - Official guides and tools
|
||||
- [Plugins](#plugins-) - what makes YOURLS so versatile and powerful
|
||||
- [Plugins](#plugins-) - what makes YOURLS so versatile and powerful.
|
||||
Currently: **<!--plugin_count-->185<!--/plugin_count-->** plugins listed.<!-- DO NOT UPDATE THIS COUNT MANUALLY -->
|
||||
- [Themes](#themes-) - to customize how YOURLS looks
|
||||
- [Translations](#translations-) - YOURLS in your language
|
||||
- [Integrations](#integrations-) - Third-party integrations and frameworks
|
||||
|
@ -30,6 +31,11 @@ Official material from the YOURLS team
|
|||
|
||||
All known plugins - either from the community, or from the YOURLS team, marked with a ☑️
|
||||
|
||||
Currently we have **<!--plugin_count-->185<!--/plugin_count-->** plugins listed.
|
||||
<!-- DO NOT UPDATE THIS COUNT MANUALLY -->
|
||||
|
||||
Willing to get your plugins featured here? Please [contribute](CONTRIBUTING.md)!
|
||||
|
||||
Jump to [0-9](#0-9-) | [A](#a-) | [B](#b-) | [C](#c-) | [D](#d-) | [E](#e-) | [F](#f-) | [G](#g-) | [H](#h-) | [I](#i-) | [J](#j-) | [K](#k-) | [L](#l-) | [M](#m-) | [N](#n-) | [O](#o-) | [P](#p-) | [Q](#q-) | [R](#r-) | [S](#s-) | [T](#t-) | [U](#u-) | [V](#v-) | [W](#w-) | [X](#x-) | [Y](#y-) | [Z](#z-)
|
||||
|
||||
### 0-9 [⇡](#plugins-)
|
||||
|
|
Loading…
Reference in a new issue