Skip to content

Add prompt artifact upload step to compiled workflows#1904

Merged
pelikhan merged 3 commits intomainfrom
copilot/update-compiler-artifact-upload
Oct 18, 2025
Merged

Add prompt artifact upload step to compiled workflows#1904
pelikhan merged 3 commits intomainfrom
copilot/update-compiler-artifact-upload

Conversation

Copy link
Contributor

Copilot AI commented Oct 17, 2025

Summary

This PR adds a step to upload the generated prompt as a workflow artifact (prompt.txt) after the prompt is rendered. This makes it easier to debug and inspect the exact instructions that were sent to the AI engine.

Changes

Added a new generateUploadPrompt() function in the compiler that generates an artifact upload step using actions/upload-artifact@v4. This step is inserted immediately after the prompt generation phase, before agent version capture, ensuring the prompt file is available as a downloadable artifact from the workflow run.

Generated Step

The compiled workflows now include:

- name: Upload prompt
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: prompt.txt
    path: /tmp/gh-aw/aw-prompts/prompt.txt
    if-no-files-found: warn

Key Features

  • Always runs: The if: always() condition ensures the prompt is uploaded even if the workflow fails, making it useful for debugging failed runs
  • Consistent pattern: Follows the same approach as other artifact uploads (aw_info.json, agent logs, etc.)
  • Universal compatibility: Works with all AI engines (copilot, claude, codex, custom)
  • Non-breaking: No changes to workflow frontmatter syntax or existing functionality

Testing

  • Added TestPromptUploadArtifact to validate the upload step generation
  • All existing unit and integration tests pass
  • Successfully recompiled all 64 workflows in the repository
  • Verified 35+ workflows now include the prompt upload step

Benefits

Users can now:

  • Download the exact prompt that was sent to the AI engine from the workflow run artifacts
  • Debug issues by inspecting the generated prompt content
  • Audit what instructions were provided to the AI for compliance and review purposes
Original prompt

Update the compiler to add a step after rendering the prompt that uploads it as an artifact (prompt.txt).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review October 18, 2025 00:07
@github-actions
Copy link
Contributor

Agentic Changeset Generator triggered by this pull request.

Copilot AI changed the title [WIP] Update compiler to upload prompt as an artifact Add prompt artifact upload step to compiled workflows Oct 18, 2025
Copilot AI requested a review from pelikhan October 18, 2025 00:11
@pelikhan pelikhan merged commit 1920b9f into main Oct 18, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/update-compiler-artifact-upload branch October 18, 2025 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants