Skip to content

Commit fb74e04

Browse files
authored
Merge branch 'master' into master
Signed-off-by: ipitio <[email protected]>
2 parents 31059b0 + 61927da commit fb74e04

File tree

2 files changed

+12
-31
lines changed

2 files changed

+12
-31
lines changed

src/bkg.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ main() {
123123
[[ "$(wc -l <"$BKG_OWNERS")" -ge $(($(sort -u "$connections" | wc -l) + 100)) ]] || seq 1 2 | env_parallel --lb --halt soon,fail=1 page_owner
124124
else
125125
get_membership "$GITHUB_OWNER" >"$connections"
126-
127-
if grep -q '/' "$BKG_OWNERS"; then
128-
: >"$BKG_OWNERS"
129-
: >"$BKG_OPTOUT"
130-
fi
126+
curl "https://raw.githubusercontent.com/ipitio/backage/refs/heads/$GITHUB_BRANCH/optout.txt" > base_out
127+
curl "https://raw.githubusercontent.com/ipitio/backage/refs/heads/$GITHUB_BRANCH/owners.txt" > base_own
128+
! diff -q "$BKG_OWNERS" base_own || : > "$BKG_OWNERS"
129+
! diff -q "$BKG_OPTOUT" base_out || : > "$BKG_OPTOUT"
130+
rm -f base_out base_own
131131
fi
132132

133133
sort "$connections" | uniq -c | sort -nr | awk '{print $2}' >"$connections".bak

src/lib/package.sh

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -78,34 +78,15 @@ update_package() {
7878
elif grep -q "$owner" "$BKG_OPTOUT"; then
7979
grep "$owner" "$BKG_OPTOUT" | while IFS= read -r match; do
8080
local match_a
81-
local owner_out=false
82-
local repo_out=false
83-
local package_out=false
81+
local owner_out
82+
local repo_out
83+
local package_out
8484
mapfile -t match_a < <(perl -pe 's,\/(?=\/),\n,g' <<<"$match")
85+
owner_out=$([[ "$owner" == "${match_a[0]}" ]] || [[ "${match_a[0]}" =~ ^/ && "$owner" =~ $(sed 's/^\/\(.*\)/\1/' <<<"${match_a[0]}") ]] && echo true || echo false)
86+
repo_out=$( ((${#match_a[@]} < 2)) || [[ "$repo" == "${match_a[1]}" ]] || [[ "${match_a[1]}" =~ ^/ && "$repo" =~ $(sed 's/^\/\(.*\)/\1/' <<<"${match_a[1]}") ]] && echo true || echo false)
87+
package_out=$( ((${#match_a[@]} < 3)) || [[ "$package" == "${match_a[2]}" ]] || [[ "${match_a[2]}" =~ ^/ && "$package" =~ $(sed 's/^\/\(.*\)/\1/' <<<"${match_a[2]}") ]] && echo true || echo false)
8588

86-
if [[ "${match_a[0]}" =~ ^/ && "$owner" =~ $(sed 's/^\/\(.*\)/\1/' <<<"${match_a[0]}") ]]; then
87-
owner_out=true
88-
else
89-
[[ "$owner" != "${match_a[0]}" ]] || owner_out=true
90-
fi
91-
92-
if [[ "${match_a[1]}" =~ ^/ && "$repo" =~ $(sed 's/^\/\(.*\)/\1/' <<<"${match_a[1]}") ]]; then
93-
repo_out=true
94-
else
95-
[[ "$repo" != "${match_a[1]}" ]] || repo_out=true
96-
fi
97-
98-
if [[ "${match_a[2]}" =~ ^/ && "$package" =~ $(sed 's/^\/\(.*\)/\1/' <<<"${match_a[2]}") ]]; then
99-
package_out=true
100-
else
101-
[[ "$package" != "${match_a[2]}" ]] || package_out=true
102-
fi
103-
104-
if ((${#match_a[@]} == 1)) && $owner_out || {
105-
((${#match_a[@]} == 2)) && $owner_out && $repo_out || {
106-
((${#match_a[@]} == 3)) && $owner_out && $repo_out && $package_out
107-
}
108-
}; then
89+
if $owner_out && $repo_out && $package_out; then
10990
optout_package "$owner_id" "$owner" "$repo" "$package" "$table_version_name"
11091
return
11192
fi

0 commit comments

Comments
 (0)