Update Single File Dependencies #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Single File Dependencies | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
defaults: | |
run: | |
shell: pwsh | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
Update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
fetch-depth: 1 | |
- name: Install | |
# Change dir to avoid problems with global.json in repo root. | |
working-directory: ${{ runner.temp }} | |
run: | | |
$ErrorActionPreference = 'Stop' | |
$PSNativeCommandUseErrorActionPreference = $true | |
dotnet tool update -g dotnet-file | |
- name: Update | |
# Both must be set because dotnet-file internally calls gh cli to fetch the changelog. | |
env: | |
GCM_CREDENTIAL_STORE: cache | |
GH_TOKEN: ${{ github.token }} | |
id: update | |
run: | | |
$ErrorActionPreference = 'Stop' | |
$PSNativeCommandUseErrorActionPreference = $true | |
[string]$tmpfile = New-TemporaryFile | |
dotnet-file update "-c:$tmpfile" | |
[string]$content = Get-Content $tmpfile -Raw | |
if (-not $content) { | |
'No changelog.' | |
} | |
else { | |
Write-Output 'Changelog<<EOF' >>$env:GITHUB_OUTPUT | |
Write-Output $content >>$env:GITHUB_OUTPUT | |
Write-Output 'EOF' >>$env:GITHUB_OUTPUT | |
$content | |
} | |
- name: Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.DOTNET_FILESYNC_PAT }} | |
base: master | |
branch: dotnet-file-sync | |
delete-branch: true | |
labels: dependencies | |
title: Update Single File Dependencies | |
body: ${{ steps.update.outputs.Changelog }} | |
commit-message: | | |
Update Single File Dependencies | |
${{ steps.update.outputs.Changelog }} |