Skip to content

Commit

Permalink
attach patch as artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsimons committed Dec 2, 2024
1 parent 3e4cd77 commit b5fb2a9
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/run-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,13 @@ jobs:
- name: Commit changes
shell: pwsh
run: |
git diff > ../changes.diff
$changes = Get-Item ../changes.diff
git diff > ../changes.patch
$changes = Get-Item ../changes.patch
Write-Output "Diff size is $($changes.Length) bytes"
if ($changes.Length -gt 20480) {
$changesDiffContent = Get-Content -Path ../changes.diff
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value "## Changes diff"
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '```'
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $changesDiffContent
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value '```'
throw "Changes diff is > 20KB - too much change to trust without verifying"
throw "Changes diff is > 20KB - too much change to trust without verifying. changed.patch file have been created as an artifact. To merge this file run 'git apply changes.patch'"
return 1
}
if ($changes.Length -eq 0) {
Expand All @@ -71,6 +66,13 @@ jobs:
Write-Output "Pushing changes to origin"
git push origin master
- uses: actions/upload-artifact@v4
name: Attach patch as artifact
if: ${{ always() }}
with:
name: changes.patch
path: ../changes.patch
if-no-files-found: ignore
- name: Notify Slack on failure
if: ${{ failure() }}
shell: pwsh
Expand Down

0 comments on commit b5fb2a9

Please sign in to comment.