-
Notifications
You must be signed in to change notification settings - Fork 39
63 lines (54 loc) · 1.85 KB
/
update.yml
File metadata and controls
63 lines (54 loc) · 1.85 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
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Update Lists
permissions:
contents: write
concurrency:
group: "update"
cancel-in-progress: true
on:
workflow_dispatch:
schedule:
- cron: '0,30 * * * *' # every 30 minutes
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Update Lists
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# generate lists and update README
make update
# commit generated files back to repo if any changed
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md list/total.svg 2>/dev/null || true
if [ -n "$(git status --porcelain)" ]; then
timestamp=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
git commit -m "chore(list): Updated free proxy list - $timestamp"
# push using token
git push
fi
- name: Clone Wiki
run: make clone-wiki
- name: Update Wiki
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
cd ../wiki
rm -rf .git
git init
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
remote="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.wiki.git"
git remote add origin "$remote"
git add .
if [ -n "$(git status --porcelain)" ]; then
timestamp=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
git commit -m "Update proxy lists - $timestamp"
git branch -M master
git push --force origin master
fi