-
Notifications
You must be signed in to change notification settings - Fork 8
62 lines (56 loc) · 2.25 KB
/
excavator.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
# defaults:
# run:
# working-directory: v2raya-scoop
on:
workflow_dispatch:
schedule:
# run every 4 hours
- cron: "20 */4 * * *"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Excavator
jobs:
excavate:
name: Excavate
runs-on: windows-latest
steps:
- uses: actions/checkout@main
- name: Excavate
run: |
$env:SCOOP = Join-Path $env:USERPROFILE 'SCOOP'
$env:SCOOP_HOME = Join-Path $env:SCOOP 'apps\scoop\current'
$env:SCOOP_GLOBAL = Join-Path $env:SystemDrive 'SCOOP'
$env:SCOOP_DEBUG = 1
$REPOSITORY = $env:GITHUB_REPOSITORY
$BUCKET_ROOT = $env:GITHUB_WORKSPACE
$BINARIES_FOLDER = Join-Path $env:SCOOP_HOME 'bin'
$MANIFESTS_LOCATION = Join-Path $BUCKET_ROOT 'bucket'
$_BRANCH = 'main'
$email = '41898282+github-actions[bot]@users.noreply.github.com'
$user = 'github-actions[bot]'
$rem = "https://${env:GITHUB_ACTOR}:$env:GITHUB_TOKEN@github.com/$env:GITHUB_REPOSITORY.git"
Write-Host "Config git"
git config --global user.name $user
git config --global user.email $email
git remote 'set-url' --push origin $rem
Write-Host 'Installing scoop'
$f = Join-Path $env:USERPROFILE 'install.ps1'
Invoke-WebRequest 'https://raw.githubusercontent.com/ScoopInstaller/Install/master/install.ps1' -UseBasicParsing -OutFile $f
& $f -RunAsAdmin
scoop install hub
Write-Host 'Importing all modules'
# Load all scoop's modules.
# Dot sourcing needs to be done on highest scope possible to propagate into lower scopes
Get-ChildItem (Join-Path $env:SCOOP_HOME 'lib') '*.ps1' | ForEach-Object { . $_.FullName }
$params = @{
'Dir' = $MANIFESTS_LOCATION
'Upstream' = "${REPOSITORY}:${_BRANCH}"
'OriginBranch' = $_BRANCH
'Push' = $true
'SkipUpdated' = ($env:SKIP_UPDATED -eq '1')
}
$env:SCOOP_GH_TOKEN = $env:GITHUB_TOKEN
Set-PSDebug -Trace 1
& (Join-Path $BINARIES_FOLDER 'auto-pr.ps1') @params
Write-Host 'Scheduled finished'
Set-PSDebug -Trace 0