Skip to content

Support configurable named integration sources #31660

Support configurable named integration sources

Support configurable named integration sources #31660

name: Add Dogfooding Comment

Check warning on line 1 in .github/workflows/dogfood-comment.yml

View workflow run for this annotation

GitHub Actions / Add Dogfooding Comment

Workflow execution policy warning (evaluate mode)

On December 2, 2026, GitHub will restrict `pull_request_target` on public repositories by default. To continue allowing the event trigger, configure an Actions policy. Learn more: https://gh.io/securely-using-pull_request_target#default-policy-for-pull_request_target
on:
# Use pull_request_target to run in the context of the base branch
# This allows commenting on PRs from forks
pull_request_target:
# zizmor: ignore[dangerous-triggers] - the workflow never checks out or executes pull request code
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 == 'microsoft/aspire' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add dogfooding comment
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh';
const psScript = 'https://raw.githubusercontent.com/microsoft/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
});
}