-
-
Notifications
You must be signed in to change notification settings - Fork 25
50 lines (43 loc) · 1.34 KB
/
cleaner.yml
File metadata and controls
50 lines (43 loc) · 1.34 KB
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
name: "Cleaner"
on:
#schedule:
# - cron: "*/15 * * * *"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
sync-files:
name: "To clean"
runs-on: ubuntu-22.04
steps:
- name: "Checkout source repository"
uses: actions/checkout@v4
- name: "Run cleaner"
run: |
LIST=$(curl -Ls https://raw.githubusercontent.com/ivan-hc/AM/main/programs/x86_64-apps)
MDS=$(ls apps/* | sed 's:.*/::; s/.md$//g')
PNGS=$(ls icons/* | sed 's:.*/::; s/.png$//g')
for m in $MDS; do
if ! echo "$LIST" | grep -q "◆ $m :"; then
rm -f "apps/$m.md"
fi
done
for p in $PNGS; do
if ! echo "$LIST" | grep -q "◆ $p :"; then
rm -f "icons/$p.png"
fi
done
- name: "Push to Source"
run: |
git config --global user.name "Portable-Linux-Apps"
git config --global user.email "noreply@github.com"
git add apps icons
if git diff-index --quiet HEAD; then
echo "No changes to commit." >> $GITHUB_STEP_SUMMARY
else
git commit -m "Clean unneeded pages"
git push && echo "Sync to Source succeeded" >> $GITHUB_STEP_SUMMARY
fi