cmder/.github/workflows/vendor.yml

66 lines
2.1 KiB
YAML
Raw Normal View History

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