-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (68 loc) · 2.51 KB
/
check.yml
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
name: Check UUPDUMP
run-name: Check UUPDUMP ${{ inputs.DatabaseOnly == true && '(DatabaseOnly)' || '' }}
on:
schedule:
# run every 4 hours
- cron: '20 */4 * * *'
workflow_dispatch:
inputs:
DatabaseOnly:
description: '仅更新数据'
required: false
default: false
type: boolean
jobs:
check:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Change DNS Server
shell: pwsh
run: |
$newDnsServers = @('1.1.1.1', '8.8.8.8')
$networkAdapters = Get-NetAdapter | Where-Object { $_.Status -eq 'Up' }
foreach ($adapter in $networkAdapters) {
Set-DnsClientServerAddress -InterfaceIndex $adapter.ifIndex -ResetServerAddresses
Set-DnsClientServerAddress -InterfaceIndex $adapter.ifIndex -ServerAddresses $newDnsServers
}
ipconfig /flushdns
- name: Install Cloudflare WRAP
shell: pwsh
run: |
Write-Host "installing Cloudflare WARP..."
Invoke-WebRequest -Uri "https://1111-releases.cloudflareclient.com/win/latest" -OutFile "C:\cfwarp.msi"
Start-Process "msiexec.exe" -ArgumentList "/i C:\cfwarp.msi /qn" -Wait
Set-Location "C:\Program Files\Cloudflare\Cloudflare WARP"
.\warp-cli.exe registration new
.\warp-cli.exe connect
# Add a loop to wait for the status to be connected
for ($attemptCount = 0; $attemptCount -lt 10; $attemptCount++) {
$output = .\warp-cli.exe status
Write-Host $output
if ($output -like "*Status update: Connected*") {
break
}
Start-Sleep -Seconds 5 # Wait for 5 seconds before checking again
}
if ($attemptCount -eq 10) {
Write-Host "Failed to connect after 10 attempts."
exit 1 # Exit with an error code
}
- name: Small Task
shell: pwsh
env:
GH_TOKEN: ${{ secrets.RCLONE_TOKEN }}
run: |
.\.github\workflows\check.ps1 ${{ inputs.DatabaseOnly == true && '-DatabaseOnly' || '' }}
- name: Disconnect Cloudflare WRAP
shell: pwsh
run: |
Set-Location "C:\Program Files\Cloudflare\Cloudflare WARP"
.\warp-cli.exe disconnect
- name: Commit and Push Changes
shell: pwsh
run: |
git add State.json
git commit -m "Update State.json"
git push