-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (174 loc) · 9.9 KB
/
healthchecks_housekeeping.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: 🐧🧹 HealthChecks 🖳🗑️
#MAX_RUNTIME: 02 Minutes
on:
#push:
workflow_dispatch:
schedule:
# - cron: "45 03 * * *" # 03:45 AM UTC --> 09:30 AM Morning NPT
- cron: "0 */2 * * *" # Every 2 Hrs
jobs:
#------------------------------------------------------------------------------------#
check-post:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Debloat Runner
run: |
#Presets
set +x ; set +e
#--------------#
bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Github/Runners/debloat_ubuntu.sh")
continue-on-error: true
- name: Checkout repository
uses: actions/checkout@v4
with:
path: main
filter: "blob:none"
- name: Setup Env
run: |
##presets
set +x ; set +e
#-------------#
##CoreUtils
sudo apt update -y
sudo apt install bc coreutils curl dos2unix fdupes jq moreutils wget -y
sudo apt-get install apt-transport-https apt-utils ca-certificates coreutils dos2unix gnupg2 jq moreutils p7zip-full rename rsync software-properties-common texinfo tmux util-linux wget -y 2>/dev/null ; sudo apt-get update -y 2>/dev/null
#temp
SYSTMP="$(dirname $(mktemp -u))" && export SYSTMP="${SYSTMP}"
echo "SYSTMP=${SYSTMP}" >> "${GITHUB_ENV}"
continue-on-error: true
- name: Install Addons
run: |
#presets
set +x ; set +e
#-------------#
bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/main/Linux/install_bins_curl.sh")
continue-on-error: true
- name: Enrichments (User-Agents)
run: |
# Presets
set -x ; set +e
mkdir -p "${GITHUB_WORKSPACE}/main/Misc/User-Agents"
#--------------#
##Fetch
#curl -qfsSL "https://raw.githubusercontent.com/EIGHTFINITE/top-user-agents/main/index.json" | jq -r '.[]' | sort -u -o "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt"
curl -qfsSL "https://raw.githubusercontent.com/microlinkhq/top-user-agents/master/src/index.json" | jq -r '.[]' | sort -u | sort -V -o "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt"
##Filter
#Chrome-Android
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'android' | grep -iv 'edg\|moto\|obsidian\|opr\|pfum' | sort -V > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_chrome_android_all.txt"
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'android' | grep -iv 'edg\|moto\|obsidian\|opr\|pfum' | sort -V | tail -n 1 > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_chrome_android_latest.txt"
#Chrome-macOS
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'mac' | grep -i 'chrome' | grep -iv 'edg\|obsidian\|opr' | sort -V > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_chrome_macos_all.txt"
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'mac' | grep -i 'chrome' | grep -iv 'edg\|obsidian\|opr' | sort -V | tail -n 1 > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_chrome_macos_latest.txt"
#Chrome-Windows
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'Windows NT 10' | grep -i 'chrome' | grep -iv 'edg\|obsidian\|opr' | sort -V > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_chrome_windows_all.txt"
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'Windows NT 10' | grep -i 'chrome' | grep -iv 'edg\|obsidian\|opr' | sort -V | tail -n 1 > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_chrome_windows_latest.txt"
#Firefox-macOS
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'mac' | grep -i 'firefox' | grep -iv 'edg\|obsidian\|opr' | sort -V > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_firefox_macos_all.txt"
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'mac' | grep -i 'firefox' | grep -iv 'edg\|obsidian\|opr' | sort -V | tail -n 1 > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_firefox_macos_latest.txt"
#Firefox-Windows
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'Windows NT 10' | grep -i 'firefox' | grep -iv 'edg\|obsidian\|opr' | sort -V > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_firefox_windows_all.txt"
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'Windows NT 10' | grep -i 'firefox' | grep -iv 'edg\|obsidian\|opr' | sort -V | tail -n 1 > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_firefox_windows_latest.txt"
#Safari-Iphone
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'iphone' | grep -iv 'chrome\|edg\|obsidian\|opr' | sort -V > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_safari_iphone_all.txt"
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'iphone' | grep -iv 'chrome\|edg\|obsidian\|opr' | sort -V | tail -n 1 > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_safari_iphone_latest.txt"
#Safari-macOS
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'mac' | grep -i 'safari' | grep -iv 'iphone' | grep -iv 'edg\|obsidian\|opr' | sort -V > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_safari_macos_all.txt"
cat "${GITHUB_WORKSPACE}/main/Misc/User-Agents/user_agents_all.txt" | grep -i 'mac' | grep -i 'safari' | grep -iv 'iphone' | grep -iv 'edg\|obsidian\|opr' | sort -V | tail -n 1 > "${GITHUB_WORKSPACE}/main/Misc/User-Agents/ua_safari_macos_latest.txt"
continue-on-error: true
- name: Dos2Unix Everything
run: |
#Presets
set +x ; set +e
#--------------#
cd "${GITHUB_WORKSPACE}/main"
find . -type f ! -path "./.git/*" -exec dos2unix {} \; 2>/dev/null
continue-on-error: true
- name: ActionLint
run: |
#Presets
set +x ; set +e
#--------------#
cd "${GITHUB_WORKSPACE}/main"
find ".github/workflows" -type f -name "*ml" -exec actionlint {} \;
continue-on-error: true
- name: Shellcheck
run: |
#Presets
set +x ; set +e
#--------------#
cd "${GITHUB_WORKSPACE}/main"
find ".github" -type f -name '*.sh' -exec shellcheck --exclude="SC2261" --severity=error "{}" \; 2>/dev/null | tee "${GITHUB_WORKSPACE}/main/.github/shellcheck.txt"
continue-on-error: true
- name: Generate Repo Metadata (git-sizer)
run: |
#Presets
set +x ; set +e
#--------------#
cd "${GITHUB_WORKSPACE}/main"
#Dust sizes
echo '```mathematica' > "${GITHUB_WORKSPACE}/main/.github/SIZE.md"
dust -b -c -i -r -n 99999999 "${GITHUB_WORKSPACE}/main" | tee -a "${GITHUB_WORKSPACE}/main/.github/SIZE.md"
dust -b -c -i -r -n 99999999 "${GITHUB_WORKSPACE}/main" | tee "${GITHUB_WORKSPACE}/main/.github/SIZE.txt"
echo '```' >> "${GITHUB_WORKSPACE}/main/.github/SIZE.md"
continue-on-error: true
- name: Get DateTime & Purge files (=> 95 MB)
run: |
#Presets
set +x ; set +e
#--------------#
UTC_TIME="$(TZ='UTC' date +'%Y-%m-%d (%I:%M:%S %p)')"
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}"
#Purge
find "${GITHUB_WORKSPACE}/main" -path "${GITHUB_WORKSPACE}/main/.git" -prune -o -type f -size +95M -exec rm -rvf "{}" + 2>/dev/null
continue-on-error: true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
repository: ./main
commit_user_name: Azathothas
commit_user_email: [email protected]
commit_message: " "
#commit_message: "✅ Updated (Metadata) 🛍️ <-- ${{ env.UTC_TIME }} ⌚"
#push_options: '--force'
continue-on-error: true
- name: Common Utils
env:
GITHUB_TOKEN: "${{ github.token }}"
run: |
#Presets
set +x ; set +e
#--------------#
mkdir -pv "/tmp/COMMON"
eget "https://github.com/Morganamilo/paru" --asset "aarch64" --file "paru" --to "/tmp/COMMON/paru-aarch64"
eget "https://github.com/Morganamilo/paru" --asset "x86_64" --file "paru" --to "/tmp/COMMON/paru-x86_64"
eget "https://github.com/Jguer/yay" --asset "aarch64" --file "yay" --to "/tmp/COMMON/yay-aarch64"
eget "https://github.com/Jguer/yay" --asset "x86_64" --file "yay" --to "/tmp/COMMON/yay-x86_64"
eget "https://github.com/VHSgunzo/runimage-fake-sudo-pkexec" --asset "any" --asset "tar.zst" --download-only --to "/tmp/COMMON/fake-sudo-pkexec.tar.zst"
if [[ -s "/tmp/COMMON/fake-sudo-pkexec.tar.zst" ]] && \
[[ -s "/tmp/COMMON/paru-aarch64" ]] && \
[[ -s "/tmp/COMMON/paru-x86_64" ]] && \
[[ -s "/tmp/COMMON/yay-aarch64" ]] && \
[[ -s "/tmp/COMMON/yay-x86_64" ]]; then
export HAS_COMMON="TRUE"
echo "HAS_COMMON=${HAS_COMMON}" >> "${GITHUB_ENV}"
UTC_TIME="$(TZ='UTC' date +'%Y_%m_%d')"
echo "UTC_TIME=${UTC_TIME}" >> "${GITHUB_ENV}"
else
export HAS_COMMON="FALSE"
echo "HAS_COMMON=${HAS_COMMON}" >> "${GITHUB_ENV}"
fi
continue-on-error: true
#continuous
- name: Releaser (Continuous)
if: env.HAS_COMMON == 'TRUE'
uses: softprops/[email protected]
with:
name: "Common Utils"
tag_name: "common-utils"
prerelease: true
draft: false
generate_release_notes: false
files: |
/tmp/COMMON/*
continue-on-error: true