diff --git a/.github/workflows/update-winget-manifest.yml b/.github/workflows/update-winget-manifest.yml index 0004f0f..e22feac 100644 --- a/.github/workflows/update-winget-manifest.yml +++ b/.github/workflows/update-winget-manifest.yml @@ -20,6 +20,7 @@ jobs: permissions: contents: read pull-requests: write + issues: write runs-on: windows-latest @@ -44,6 +45,7 @@ jobs: echo "Version: $VERSION (tag: $TAG)" - name: Submit package using wingetcreate + id: submit shell: pwsh run: | $packageId = "GitHub.Copilot.modernization.agent" @@ -86,4 +88,33 @@ jobs: exit 1 } $manifestPath = Split-Path $installerManifest - .\wingetcreate.exe submit $manifestPath + $output = .\wingetcreate.exe submit $manifestPath --prtitle "Update GitHub.Copilot.modernization.agent to $version" 2>&1 + Write-Output $output + + # Extract PR URL from output + $prUrl = "" + if ($output -match 'https://github\.com/microsoft/winget-pkgs/pull/\d+') { + $prUrl = $matches[0] + Write-Output "PR URL: $prUrl" + echo "pr_url=$prUrl" >> $env:GITHUB_OUTPUT + } else { + Write-Warning "Could not extract PR URL from output" + echo "pr_url=" >> $env:GITHUB_OUTPUT + } + + - name: Create tracking issue + uses: actions/github-script@v7 + with: + script: | + const prUrl = '${{ steps.submit.outputs.pr_url }}'; + const body = prUrl + ? `A PR has been submitted to microsoft/winget-pkgs for version ${{ steps.version.outputs.version }}.\n\nPR: ${prUrl}` + : `A PR has been submitted to microsoft/winget-pkgs for version ${{ steps.version.outputs.version }}.\n\nCheck https://github.com/microsoft/winget-pkgs/pulls for status.`; + + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: `WinGet PR submitted for v${{ steps.version.outputs.version }}`, + body: body, + assignees: ['qianwens', 'shizhMSFT', 'galiacheng'] + }); diff --git a/.github/workflows/validate-homebrew.yml b/.github/workflows/validate-homebrew.yml index 8eb329a..0df3410 100644 --- a/.github/workflows/validate-homebrew.yml +++ b/.github/workflows/validate-homebrew.yml @@ -7,6 +7,11 @@ on: jobs: validate-homebrew: if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Update Homebrew formula') + + permissions: + contents: read + issues: write + strategy: fail-fast: false matrix: @@ -41,6 +46,7 @@ jobs: echo "Expected version: $version" - name: Verify installation + id: verify run: | output=$(modernize --version) echo "Version output: $output" @@ -50,3 +56,17 @@ jobs: echo "::error::Version mismatch. Expected '${{ steps.formula.outputs.version }}' in output but got: $output" exit 1 fi + + - name: Create issue on failure + if: failure() + uses: actions/github-script@v7 + with: + script: | + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: `Homebrew validation failed on ${{ matrix.name }}`, + body: `Homebrew installation validation failed for **${{ matrix.name }}**.\n\n**PR:** #${{ github.event.pull_request.number }}\n**Expected version:** ${{ steps.formula.outputs.version }}\n**Workflow run:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n\nPlease investigate the failure.`, + labels: ['homebrew', 'validation-failure'], + assignees: ['galiacheng'] + });