Refactor output #21
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 NuGet packages | |
on: | |
workflow_dispatch: | |
schedule: | |
# Every Sunday at 8am | |
- cron: '0 8 * * Sun' | |
push: | |
branches: | |
- 'sebros/outdated' | |
permissions: | |
issues: write | |
pull-requests: write | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
name: Check Versions and Create PR | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run dotnet outdated | |
id: dotnet_outdated | |
run: | | |
mkdir ${{ runner.temp }}/build_logs | |
dotnet tool install --global dotnet-outdated-tool | |
exec 5>&1 | |
OUTPUT=$(dotnet-outdated --version-lock major --output-format markdown --no-restore --output ${{ runner.temp }}/build_logs/dotnet-updated.md --upgrade --exclude "Microsoft.AspNetCore" --exclude "Microsoft.Extensions.Caching.StackExchangeRedis"|tee /dev/fd/5) | |
if [[ $OUTPUT =~ "No outdated dependencies were detected" ]]; then | |
echo "{updated}={false}" >> $GITHUB_OUTPUT | |
else | |
echo "{updated}={true}" >> $GITHUB_OUTPUT | |
fi | |
echo $OUTPUT | |
shell: bash | |
- name: Create pull request | |
if: steps.dotnet_outdated.outputs.updated == 'true' | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git checkout -b gh/outdated | |
git pull | |
git commit -am "Update NuGet packages" | |
git push origin HEAD | |
gh pr create --base main --head gh/outdated --title 'Update NuGet packages' --body-file ${{ runner.temp }}/build_logs/dotnet-updated.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |