Skip to content

[ci] Add /apply-gist workflow for updating expected app size files#25974

Open
rolfbjarne wants to merge 3 commits into
mainfrom
dev/rolf/app-size-gist-workflow
Open

[ci] Add /apply-gist workflow for updating expected app size files#25974
rolfbjarne wants to merge 3 commits into
mainfrom
dev/rolf/app-size-gist-workflow

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

When the AppSizeTest fails in CI:

  1. The Azure DevOps pipeline creates a GitHub gist with the updated
    expected files and posts a PR comment with the gist URL.
  2. A maintainer can comment /apply-gist <url> on the PR to trigger
    a GitHub Actions workflow that downloads the gist files and commits
    them to the PR branch.

Security:

  • Only comments from users with write access are honored
  • Only gists from approved owners are accepted (currently
    vs-mobiletools-engineering-service2)

🤖 Pull request created by Copilot

When the AppSizeTest fails in CI:
1. The Azure DevOps pipeline creates a GitHub gist with the updated
   expected files and posts a PR comment with the gist URL.
2. A maintainer can comment '/apply-gist <url>' on the PR to trigger
   a GitHub Actions workflow that downloads the gist files and commits
   them to the PR branch.

Security:
- Only comments from users with write access are honored
- Only gists from approved owners are accepted (currently
  vs-mobiletools-engineering-service2)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review July 8, 2026 19:15
Copilot AI review requested due to automatic review settings July 8, 2026 19:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a CI-assisted flow to update AppSizeTest expected files by publishing the updated .txt files to a GitHub gist and providing a /apply-gist <url> slash-command that applies those files back onto the PR branch automatically.

Changes:

  • Extend the Azure DevOps test pipeline to create a gist containing updated expected app size files and comment on the PR with an /apply-gist command.
  • Add a new GitHub Actions workflow (Apply Gist) that validates the commenter + gist owner, downloads gist files, and commits them to tests/dotnet/UnitTests/expected/.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
tools/devops/automation/templates/tests/run-tests.yml Adds an ADO step to gist-upload updated expected files and comment on the PR with the apply command.
.github/workflows/apply-gist.yml New workflow that responds to /apply-gist comments and applies gist contents to expected app size files.

Comment thread .github/workflows/apply-gist.yml
Comment thread .github/workflows/apply-gist.yml
Comment thread .github/workflows/apply-gist.yml
Comment thread .github/workflows/apply-gist.yml
Comment thread .github/workflows/apply-gist.yml
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

dalexsoto
dalexsoto previously approved these changes Jul 9, 2026
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🚀 [CI Build #4686ad2] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 199 tests passed 🎉

Tests counts

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 17 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 18 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: 4686ad203c1244fb897287ff65323725c0d59c05 [PR build]

- Add issues: write permission (needed for reactions/comments)
- Handle null gist owner gracefully
- Reject fork PRs early with a clear message
- Export EXPECTED_DIR so the Python subprocess can access it
- Validate filenames with a strict regex pattern to prevent path
  traversal (only allow known patterns like *-size.txt and
  *-preservedapis.txt)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: d464ded6232e64cd9193af69cd2075de48c603a3 [PR build]

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment on lines +203 to +209
# Create gist with all updated files
# shellcheck disable=SC2086
GIST_URL=$(gh gist create --public -d "Updated expected app size files for PR #$PR_NUMBER (${{ parameters.testPrefix }})" $FILES 2>&1)
if [ $? -ne 0 ]; then
echo "##[warning]Failed to create gist: $GIST_URL"
exit 0
fi

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is valid; use a private gist.

Comment on lines +136 to +159
# Download gist metadata to get file URLs
GIST_JSON=$(gh api "gists/$GIST_ID")
echo "$GIST_JSON" | python3 -c "
import json, sys, urllib.request, os, re

gist = json.load(sys.stdin)
expected_dir = os.environ['EXPECTED_DIR']
files = gist['files']
# Only allow known expected-file patterns
allowed_pattern = re.compile(r'^[A-Za-z0-9]+-[A-Za-z0-9-]+-(size|preservedapis)\.txt$')
for filename, file_info in files.items():
if not allowed_pattern.match(filename):
print(f'Skipping file with unexpected name: {filename}')
continue
content = file_info.get('content')
if content is None:
# Large files need to be fetched from raw_url
raw_url = file_info['raw_url']
content = urllib.request.urlopen(raw_url).read().decode('utf-8')
dest = os.path.join(expected_dir, filename)
with open(dest, 'w') as f:
f.write(content)
print(f'Applied: {filename}')
"
Comment thread .github/workflows/apply-gist.yml
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants