Skip to content

fix: comment on winget PR correctly #5789

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 3 commits into from
Jan 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ jobs:
retention-days: 7

publish-winget:
name: Publish to winget-pkgs
runs-on: windows-latest
needs: release
steps:
Expand Down Expand Up @@ -308,18 +309,22 @@ jobs:
--submit `
--version "${version}" `
--urls "${installer_url}|X64" `
--token "${{ secrets.CDRCI_GITHUB_TOKEN }}"
--token "$env:WINGET_GH_TOKEN"

env:
# For gh CLI:
GH_TOKEN: ${{ github.token }}
# For wingetcreate. We need a real token since we're pushing a commit
# to GitHub and then making a PR in a different repo.
WINGET_GH_TOKEN: ${{ secrets.CDRCI_GITHUB_TOKEN }}

- name: Comment on PR
if: ${{ !inputs.dry_run }}
run: |
# Find the PR that wingetcreate just made.
$version = "${{ needs.release.outputs.version }}".Trim('v')
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${version}" --limit 1 --json number | `
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this backtick at the end be removed too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backtick is the equivalent of \ at the end of the line in powershell, so this is intentional

ConvertFrom-Json`
ConvertFrom-Json
$pr_number = $pr_list[0].number

gh pr comment --repo microsoft/winget-pkgs "${pr_number}" --body "🤖 cc: @deansheather @matifali"
Expand Down