2022-10-15 20:09:57 +08:00
|
|
|
name: Update Vendor
|
|
|
|
|
|
|
|
on:
|
2022-10-15 20:18:13 +08:00
|
|
|
workflow_dispatch:
|
2022-10-15 20:09:57 +08:00
|
|
|
schedule:
|
|
|
|
# At 13:37 UTC every day.
|
|
|
|
- cron: '37 13 * * *'
|
2022-10-18 01:30:30 +08:00
|
|
|
|
2022-10-15 20:09:57 +08:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: pwsh
|
2022-10-18 01:30:30 +08:00
|
|
|
|
2022-10-15 20:09:57 +08:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
vendor:
|
|
|
|
|
|
|
|
runs-on: windows-latest
|
|
|
|
continue-on-error: false
|
|
|
|
timeout-minutes: 15
|
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
pull-requests: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-10-18 01:30:30 +08:00
|
|
|
|
2022-10-18 02:44:00 +08:00
|
|
|
- id: make-changes
|
2022-10-18 17:14:59 +08:00
|
|
|
name: Checking for updates
|
2022-12-16 05:05:13 +08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-10-18 02:44:00 +08:00
|
|
|
run: |
|
2022-10-18 01:30:30 +08:00
|
|
|
$currentVersion = (Get-Content .\vendor\sources.json | ConvertFrom-Json)
|
|
|
|
. .\scripts\update.ps1 -verbose
|
2022-10-18 01:41:37 +08:00
|
|
|
Set-GHVariable -Name COUNT_UPDATED -Value $count
|
2022-10-18 01:30:30 +08:00
|
|
|
$newVersion = (Get-Content .\vendor\sources.json | ConvertFrom-Json)
|
|
|
|
$listUpdated = ""
|
2022-10-18 02:21:35 +08:00
|
|
|
$updateMessage = "| Name | Old Version | New Version |`n| :--- | ---- | ---- |`n"
|
2022-10-18 01:32:53 +08:00
|
|
|
foreach ($s in $newVersion) {
|
2022-10-18 01:30:30 +08:00
|
|
|
$oldVersion = ($currentVersion | Where-Object {$_.name -eq $s.name}).version
|
|
|
|
if ($s.version -ne $oldVersion) {
|
2022-10-23 22:39:35 +08:00
|
|
|
$repoUrl = ($repoUrl = $s.Url.Replace("/archive/", "/releases/")).Substring(0, $repoUrl.IndexOf("/releases/")) + "/releases"
|
2022-10-18 02:49:37 +08:00
|
|
|
$listUpdated += "$($s.name) v$($s.version), "
|
2022-10-23 22:39:35 +08:00
|
|
|
$updateMessage += "| **[$($s.name)]($repoUrl)** | $oldVersion | **$($s.version)** |`n"
|
2022-10-18 01:30:30 +08:00
|
|
|
}
|
|
|
|
}
|
2022-10-18 17:00:55 +08:00
|
|
|
if ($count -eq 0) { return }
|
2022-10-18 01:49:19 +08:00
|
|
|
Set-GHVariable -Name LIST_UPDATED -Value $listUpdated.Trim(', ')
|
2022-10-18 04:16:14 +08:00
|
|
|
echo "UPDATE_MESSAGE<<<EOF`n$updateMessage`n<EOF" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
2022-10-15 20:09:57 +08:00
|
|
|
|
2023-04-11 00:02:00 +08:00
|
|
|
- uses: peter-evans/create-pull-request@v5
|
2022-10-18 17:00:55 +08:00
|
|
|
if: env.COUNT_UPDATED > 0
|
2022-10-15 20:09:57 +08:00
|
|
|
with:
|
2022-10-18 01:30:30 +08:00
|
|
|
title: 'Updates to `${{ env.COUNT_UPDATED }}` vendored dependencies'
|
2022-10-18 02:21:35 +08:00
|
|
|
body: |
|
|
|
|
### Automatically updated `${{ env.COUNT_UPDATED }}` dependencies:
|
2022-10-18 02:55:09 +08:00
|
|
|
${{ env.UPDATE_MESSAGE }}
|
2022-10-18 02:21:35 +08:00
|
|
|
---
|
|
|
|
Please verify and then **Merge** the pull request to update.
|
2022-10-23 23:04:36 +08:00
|
|
|
commit-message: '⬆️ Update dependencies (${{ env.LIST_UPDATED }})'
|
2022-10-15 20:09:57 +08:00
|
|
|
branch: update-vendor
|
|
|
|
base: master
|