Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
O
omf-packages-main
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
omf-packages-main
Commits
3a3e3449
Commit
3a3e3449
authored
Jul 30, 2021
by
Pablo Santiago Blum de Aguiar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for dead repositories
parent
7c06dae6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
0 deletions
+114
-0
.github/workflows/check-dead-repos.fish
.github/workflows/check-dead-repos.fish
+48
-0
.github/workflows/check-dead-repos.py
.github/workflows/check-dead-repos.py
+44
-0
.github/workflows/check-dead-repos.yml
.github/workflows/check-dead-repos.yml
+22
-0
No files found.
.github/workflows/check-dead-repos.fish
0 → 100644
View file @
3a3e3449
#!/usr/bin/env fish
# A Fish script to check for "dead" repositories
# This file is part of Oh My Fish's packages-main
# https://github.com/oh-my-fish/packages-main
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2021, Fabian Homborg <FHomborg@gmail.com>
# Copyright (c) 2021, Pablo S. Blum de Aguiar <scorphus@gmail.com>
function read_repository -a user_repo
set -l url https://api.github.com/repos/$user_repo
test "$USERNAME:$TOKEN" != ":"
and curl -s -u $USERNAME:$TOKEN $url
or curl -s $url
end
set -l packages packages/*
set -l python_script (type -p read_repository | sed s/\\.fish\$/\\.py/)
set -l count 0
for package in $packages
set -l url (string replace -rf 'repository *= *(.*)' '$1' < $package)
or begin
echo $package has no repository line ❌
continue
end
set url (string replace -r '.git$' '' -- $url | string trim -c '/')
set package (string replace -r '.*/' '' $package)
set -l user_repo (string replace 'https://github.com/' '' $url)
or begin
echo $package is not on GitHub -- $url ⚠️
continue
end
read_repository $user_repo | python $python_script $package
set count (math $count + $status)
end
set -l total (ls $packages | wc -l)
if test $count -gt 0
echo Found $count/$total repositories with issues 💥
exit 1
end
echo No issues found in $total repositories 🤘
.github/workflows/check-dead-repos.py
0 → 100644
View file @
3a3e3449
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# A Python script to check repositories statuses
# This file is part of Oh My Fish's packages-main
# https://github.com/oh-my-fish/packages-main
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2021, Fabian Homborg <FHomborg@gmail.com>
# Copyright (c) 2021, Pablo S. Blum de Aguiar <scorphus@gmail.com>
import
json
import
logging
import
os
import
sys
logging
.
basicConfig
(
level
=
os
.
environ
.
get
(
'LOG_LEVEL'
,
'warning'
)
.
upper
())
data
=
sys
.
stdin
.
read
()
try
:
repo
=
json
.
loads
(
data
)
logging
.
debug
(
"repo:
%
s"
,
repo
)
except
:
logging
.
exception
(
"error parsing response"
)
repo
=
None
if
not
repo
:
logging
.
error
(
"
%
s could not be read ❌"
,
sys
.
argv
[
1
])
elif
"documentation_url"
in
repo
:
logging
.
critical
(
"rate limit exceeded when reading
%
s"
,
sys
.
argv
[
1
])
elif
repo
.
get
(
"message"
,
""
)
==
"Moved Permanently"
:
logging
.
error
(
"
%
s has moved permanently ❌"
,
sys
.
argv
[
1
])
elif
repo
.
get
(
"message"
,
""
)
==
"Not Found"
:
logging
.
error
(
"
%
s does not exist ❌"
,
sys
.
argv
[
1
])
elif
repo
.
get
(
"archived"
,
False
):
logging
.
error
(
"
%
s has been archived ❌"
,
sys
.
argv
[
1
])
elif
repo
.
get
(
"has_issues"
)
is
False
:
logging
.
error
(
"
%
s has issues disabled ❌"
,
sys
.
argv
[
1
])
else
:
logging
.
info
(
"
%
s is okay ✅"
,
sys
.
argv
[
1
])
sys
.
exit
(
0
)
sys
.
exit
(
1
)
.github/workflows/check-dead-repos.yml
0 → 100644
View file @
3a3e3449
name
:
Check for dead repositories
on
:
push
:
pull_request
:
schedule
:
-
cron
:
'
30
5,17
*
*
*'
jobs
:
check-dead-repos
:
runs-on
:
ubuntu-latest
env
:
HOME
:
/home/nemo
USERNAME
:
${{ secrets.USERNAME }}
TOKEN
:
${{ secrets.TOKEN }}
container
:
ohmyfish/ohmyfish
steps
:
-
name
:
Change current working directory owner and group
run
:
sudo chown -R nemo:nemo .
-
uses
:
actions/checkout@v2
-
name
:
Install dependencies
run
:
sudo apk add python3
-
name
:
Check dead repositories
run
:
fish .github/workflows/check-dead-repos.fish
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment