Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 0 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!!
-->
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/dogfood-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Add Dogfooding Comment

on:
# Use pull_request_target to run in the context of the base branch
# This allows commenting on PRs from forks
pull_request_target:
types: [opened, reopened, synchronize]
branches:
- 'main'
- 'net*'
- 'release/**'

# Allow manual triggering
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to add dogfooding comment to'
required: true
type: number

jobs:
add-dogfood-comment:
# Only run on the dotnet org to avoid running on forks
if: ${{ github.repository_owner == 'dotnet' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- name: Add dogfooding comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
// Get PR number from either the PR event or manual input
const prNumber = context.payload.number || context.payload.inputs?.pr_number;

const bashScript = 'https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh';
const psScript = 'https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1';

// Unique marker to identify dogfooding comments
const dogfoodMarker = '<!-- dogfood-pr -->';

const comment = `${dogfoodMarker}
🚀 **Dogfood this PR with:**

> **⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.**

\`\`\`bash
curl -fsSL ${bashScript} | bash -s -- ${prNumber}
\`\`\`

Or

- Run remotely in PowerShell:

\`\`\`powershell
iex "& { $(irm ${psScript}) } ${prNumber}"
\`\`\``;

// Check for existing dogfooding comment
const comments = await github.rest.issues.listComments({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
});

const existingComment = comments.data.find(comment => comment.body.includes(dogfoodMarker));

if (existingComment) {
// Update existing comment
await github.rest.issues.updateComment({
comment_id: existingComment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
} else {
// Create new comment
await github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
}
4 changes: 2 additions & 2 deletions eng/pipelines/ci-device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trigger:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand All @@ -33,7 +33,7 @@ pr:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/ci-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trigger:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/ci-uitests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trigger:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand All @@ -31,7 +31,7 @@ pr:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trigger:
exclude:
- '**.md'
- eng/Version.Details.xml
- .github/*
- .github/**
- docs/*
- LICENSE.TXT
- PATENTS.TXT
Expand All @@ -31,7 +31,7 @@ pr:
exclude:
- '**.md'
- eng/Version.Details.xml
- .github/*
- .github/**
- docs/*
- LICENSE.TXT
- PATENTS.TXT
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trigger:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand All @@ -31,7 +31,7 @@ pr:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/handlers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trigger:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
Expand All @@ -30,7 +30,7 @@ pr:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- CODE-OF-CONDUCT.md
- CONTRIBUTING.md
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ trigger:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand All @@ -31,7 +31,7 @@ pr:
include:
- '*'
exclude:
- .github/*
- .github/**
- docs/*
- src/Templates/*
- CODE-OF-CONDUCT.md
Expand Down
128 changes: 128 additions & 0 deletions eng/scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# .NET MAUI PR Artifact Scripts

Scripts to test .NET MAUI pull request builds in your own projects before they're merged.

## Scripts

- `get-maui-pr.sh` - Bash script for Unix-like systems (Linux, macOS)
- `get-maui-pr.ps1` - PowerShell script for cross-platform use (Windows, Linux, macOS)

## Quick Start

> **⚠️ WARNING:** Always review the PR code before running these scripts. Only test PRs you trust.

**Bash:**

```bash
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- <PR_NUMBER>
```

**PowerShell:**

```powershell
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } <PR_NUMBER>"
```

## NuGet Hive Path

Downloaded packages are stored in a hive directory:

- **Unix (Linux/macOS)**: `~/.maui/hives/pr-<PR_NUMBER>/packages`
- **Windows**: `%USERPROFILE%\.maui\hives\pr-<PR_NUMBER>\packages`

## Requirements

- .NET SDK installed
- A .NET MAUI project (`.csproj` with `<UseMaui>true</UseMaui>`)
- Internet connection
- **Bash only**: `curl`, `jq`, and `unzip`

## Parameters

### Bash Script (`get-maui-pr.sh`)

| Argument | Description | Required |
|----------|-------------|----------|
| 1st | PR number to test | Yes |
| 2nd | Path to .csproj file | No (auto-detects) |

### PowerShell Script (`get-maui-pr.ps1`)

| Parameter | Description | Default |
|-----------|-------------|---------|
| `-PrNumber` | PR number to test | Required |
| `-ProjectPath` | Path to .csproj file | Auto-detect |

## Usage Examples

### Bash Script Examples

```bash
# Test PR in current directory
./get-maui-pr.sh 33002

# Test PR with specific project
./get-maui-pr.sh 33002 ./MyApp/MyApp.csproj
```

### PowerShell Script Examples

```powershell
# Test PR in current directory
.\get-maui-pr.ps1 33002

# Test PR with specific project
.\get-maui-pr.ps1 -PrNumber 33002 -ProjectPath ./MyApp/MyApp.csproj
```

## Repository Override

You can point the scripts at a fork by setting the `MAUI_REPO` environment variable to `owner/name` before invoking the script (defaults to `dotnet/maui`).

```bash
export MAUI_REPO=myfork/maui
./get-maui-pr.sh 1234
```

```powershell
$env:MAUI_REPO = 'myfork/maui'
./get-maui-pr.ps1 1234
```

## Reverting Changes

**TIP:** Use a separate Git branch for testing!

```bash
git checkout -b test-pr-33002
# ... test the PR ...
git checkout main # Easy revert!
```

Or manually revert:

1. Edit your `.csproj` - change package version back to stable (see [NuGet](https://www.nuget.org/packages/Microsoft.Maui.Controls))
2. Remove the `maui-pr-build` source from `NuGet.config`
3. Run `dotnet restore --force`

## Troubleshooting

### Common Issues

1. **"No build found for PR"**: The PR may not have a completed build yet. Check the PR on GitHub for build status.
2. **"No .NET MAUI project found"**: Ensure you're in a directory with a `.csproj` file that has `<UseMaui>true</UseMaui>`.
3. **"Failed to download artifacts"**: Check your internet connection. Artifacts may have expired for older PRs.

### Getting Help

Run the PowerShell script with the help flag to see detailed usage information:

```powershell
Get-Help .\get-maui-pr.ps1 -Detailed
```

## More Information

- [Testing PR Builds Wiki](https://github.com/dotnet/maui/wiki/Testing-PR-Builds)
- [.NET MAUI Nightly Builds](https://github.com/dotnet/maui/wiki/Nightly-Builds)
- [Contributing Guide](https://github.com/dotnet/maui/blob/main/CONTRIBUTING.md)
Loading
Loading