Skip to content

Add manual-approval field to on section for environment-gated workflows#2959

Merged
pelikhan merged 3 commits intomainfrom
copilot/update-manual-approval-field
Nov 1, 2025
Merged

Add manual-approval field to on section for environment-gated workflows#2959
pelikhan merged 3 commits intomainfrom
copilot/update-manual-approval-field

Conversation

Copy link
Contributor

Copilot AI commented Nov 1, 2025

Adds manual-approval field to the on: section in workflow frontmatter that sets the environment: field on the activation job, enabling manual approval gates via GitHub environment protection rules.

Implementation

  • Schema: Added manual-approval string field to on: object in main_workflow_schema.json
  • Extraction: Created manual_approval.go with extraction logic following stop-after pattern
  • Compilation: Set Environment on activation job in buildActivationJob() when field is present
  • Lock file cleanup: Extended commentOutProcessedFieldsInOnSection() to strip manual-approval, stop-after, and reaction from compiled YAML (these are processed into job properties, not trigger configs)

Usage

---
on:
  workflow_dispatch:
  manual-approval: production
permissions:
  contents: read
engine: copilot
---

Generates activation job with:

activation:
  environment: production
  steps: [...]

And comments in lock file:

# Manual approval required: environment 'production'

"on":
  # manual-approval: production # Manual approval processed as environment field in activation job
  workflow_dispatch: null
Original prompt

Add a "manual-approval" field to the "on" section in the front matter that emits an environment field in the "activation" job.

The purpose of this field is to specify an environment that allows a user to manually allow an action run.

The field takes a string that should be a valid environment in the repo.

  • update schema
  • update compiler
  • make sure it is commented in the compiled action
  • make sure it gets generated in the activation job

💡 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.

Copilot AI and others added 2 commits November 1, 2025 19:10
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add manual approval field to on section in front matter Add manual-approval field to on section for environment-gated workflows Nov 1, 2025
Copilot AI requested a review from pelikhan November 1, 2025 19:23
@@ -0,0 +1,14 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot move file to folder other test agentic workflows

@pelikhan pelikhan marked this pull request as ready for review November 1, 2025 19:26
Copilot AI review requested due to automatic review settings November 1, 2025 19:26
@pelikhan pelikhan enabled auto-merge (squash) November 1, 2025 19:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds manual approval functionality to GitHub Agentic Workflows, allowing workflows to require approval via GitHub Environments before execution. The key changes include:

  • Added manual-approval field to the workflow schema that accepts an environment name
  • Workflows with manual approval now set the environment field on the activation job, triggering GitHub's built-in environment protection rules
  • Added comprehensive test coverage with unit tests and integration tests
  • Updated documentation to reflect the new feature

Reviewed Changes

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

Show a summary per file
File Description
pkg/workflow/manual_approval.go Core logic for extracting and validating manual-approval configuration from frontmatter
pkg/workflow/manual_approval_test.go Unit tests for manual approval extraction and processing
pkg/workflow/manual_approval_integration_test.go Integration tests validating compiled YAML output
pkg/workflow/compiler.go Added ManualApproval field to WorkflowData struct and wired up processing
pkg/workflow/compiler_jobs.go Modified buildActivationJob to set environment field when manual approval is configured
pkg/workflow/compiler_yaml.go Added comment header to lock files indicating manual approval requirement
pkg/workflow/frontmatter_extraction.go Added logic to comment out manual-approval field in compiled YAML
pkg/parser/schemas/main_workflow_schema.json Added manual-approval to JSON schema
docs/src/content/docs/reference/frontmatter-full.md Documentation updates for the new field
docs/src/content/docs/status.mdx Added new test workflow to status page
.github/workflows/test-manual-approval.md Test workflow demonstrating manual approval usage
.github/workflows/test-manual-approval.lock.yml Compiled test workflow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pelikhan pelikhan merged commit 174a632 into main Nov 1, 2025
67 of 68 checks passed
@pelikhan pelikhan deleted the copilot/update-manual-approval-field branch November 1, 2025 19:57
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.

3 participants