Skip to content

Commit eaf5339

Browse files
authored
Add files via upload
1 parent ba8d8e7 commit eaf5339

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/cleaner.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Cleaner"
2+
3+
on:
4+
#schedule:
5+
# - cron: "*/15 * * * *"
6+
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
sync-files:
18+
name: "To clean"
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- name: "Checkout source repository"
22+
uses: actions/checkout@v4
23+
24+
- name: "Run cleaner"
25+
run: |
26+
LIST=$(curl -Ls https://raw.githubusercontent.com/ivan-hc/AM/main/programs/x86_64-apps)
27+
MDS=$(ls apps/* | sed 's:.*/::; s/.md$//g')
28+
PNGS=$(ls icons/* | sed 's:.*/::; s/.png$//g')
29+
for m in $MDS; do
30+
if ! echo "$LIST" | grep -q "◆ $m :"; then
31+
rm -f "apps/$m.md"
32+
fi
33+
done
34+
for p in $PNGS; do
35+
if ! echo "$LIST" | grep -q "◆ $p :"; then
36+
rm -f "icons/$p.png"
37+
fi
38+
done
39+
40+
- name: "Push to Source"
41+
run: |
42+
git config --global user.name "Portable-Linux-Apps"
43+
git config --global user.email "[email protected]"
44+
git add apps icons
45+
if git diff-index --quiet HEAD; then
46+
echo "No changes to commit." >> $GITHUB_STEP_SUMMARY
47+
else
48+
git commit -m "Clean unneeded pages"
49+
git push && echo "Sync to Source succeeded" >> $GITHUB_STEP_SUMMARY
50+
fi

0 commit comments

Comments
 (0)