-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add GitHub Workflow to keep notices up to date #16284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
316341c
fix module install
TravisEz13 2031f32
temporarily add push trigger
TravisEz13 7da1d01
Bootstrap workflow
TravisEz13 641750b
add find-dotnet
TravisEz13 83f8c34
sync tabs
TravisEz13 439fc39
remove temp trigger
TravisEz13 16e2318
Add step to update Notices file
TravisEz13 b54154f
add GH workflow to keep the cgmanifest up to date.
TravisEz13 1c83464
Update tools/findMissingNotices.ps1
TravisEz13 275af66
refactor start-nativeexcution into build common module
TravisEz13 272b03e
combine conditions
TravisEz13 8712d06
log what we are executing
TravisEz13 e17eca8
start-nativeexecution must be in the same scope :(
TravisEz13 2ab02af
remove logging
TravisEz13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT license. | ||
|
|
||
| name: Update cgmanifest | ||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| # At 13:00 UTC every day. | ||
| - cron: '0 13 * * *' | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: pwsh | ||
|
|
||
| env: | ||
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
| POWERSHELL_TELEMETRY_OPTOUT: 1 | ||
|
|
||
| jobs: | ||
| update-cgmanifest: | ||
| name: Update cgmanifest | ||
| timeout-minutes: 15 | ||
| runs-on: windows-latest | ||
| if: github.repository == 'PowerShell/PowerShell' | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
| - name: Sync tags | ||
| run: | | ||
| git fetch --prune --unshallow --tags | ||
| - name: Install Ships provider to deal with project.assets.json | ||
| run: | | ||
| Install-Module -Name dotnet.project.assets -force | ||
| - name: Bootstrap | ||
| run: | | ||
| Import-Module ./build.psm1 | ||
| Start-PSBootStrap | ||
| - name: Update Notices file | ||
| run: | | ||
| Invoke-WebRequest -Uri https://aka.ms/pwsh-daily-tpn -OutFile ./ThirdPartyNotices.txt | ||
| - name: Execute script to update cgmanifest | ||
| run: | | ||
| Import-Module ./build.psm1 | ||
| Find-Dotnet | ||
| ./tools/findMissingNotices.ps1 | ||
| - name: Microsoft Teams Notifier | ||
| uses: skitionek/notify-microsoft-teams@master | ||
| if: failure() | ||
| with: | ||
| webhook_url: ${{ secrets.PS_BUILD_TEAMS_CHANNEL }} | ||
| overwrite: "{title: `Failure in updating cgmanifest. Look at ${workflow_link}`}" | ||
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v3 | ||
| id: cpr | ||
| if: env.CREATE_PR == 'true' | ||
| with: | ||
| commit-message: "Update the cgmanifest with missing or updated components" | ||
| committer: GitHub <[email protected]> | ||
| author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
| title: "Update ${{ env.FORMULA_NAME }} formula to version ${{ env.NEW_FORMULA_VERSION }}" | ||
| reviewers: travisez13 | ||
| base: master | ||
| draft: false | ||
| branch: update-cgmanifest | ||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| # this function wraps native command Execution | ||
| # for more information, read https://mnaoumov.wordpress.com/2015/01/11/execution-of-external-commands-in-powershell-done-right/ | ||
| function script:Start-NativeExecution { | ||
| param( | ||
| [Alias('sb')] | ||
| [Parameter(Mandatory=$true)] | ||
| [scriptblock]$ScriptBlock, | ||
| [switch]$IgnoreExitcode, | ||
| [switch]$VerboseOutputOnError | ||
| ) | ||
|
|
||
| $backupEAP = $ErrorActionPreference | ||
| $ErrorActionPreference = "Continue" | ||
| Write-Verbose "Executing: $ScriptBlock" | ||
| try { | ||
| if ($VerboseOutputOnError.IsPresent) { | ||
| $output = & $ScriptBlock 2>&1 | ||
| } else { | ||
| & $ScriptBlock | ||
| } | ||
|
|
||
| # note, if $ScriptBlock doesn't have a native invocation, $LASTEXITCODE will | ||
| # point to the obsolete value | ||
| if ($LASTEXITCODE -ne 0 -and -not $IgnoreExitcode) { | ||
| if ($VerboseOutputOnError.IsPresent -and $output) { | ||
| $output | Out-String | Write-Verbose -Verbose | ||
| } | ||
|
|
||
| # Get caller location for easier debugging | ||
| $caller = Get-PSCallStack -ErrorAction SilentlyContinue | ||
| if ($caller) { | ||
| $callerLocationParts = $caller[1].Location -split ":\s*line\s*" | ||
| $callerFile = $callerLocationParts[0] | ||
| $callerLine = $callerLocationParts[1] | ||
|
|
||
| $errorMessage = "Execution of {$ScriptBlock} by ${callerFile}: line $callerLine failed with exit code $LASTEXITCODE" | ||
| throw $errorMessage | ||
| } | ||
| throw "Execution of {$ScriptBlock} failed with exit code $LASTEXITCODE" | ||
| } | ||
| } finally { | ||
| $ErrorActionPreference = $backupEAP | ||
| } | ||
| } |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.