Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

Implements action-mode: script feature flag that runs setup.sh from a checked-out .github folder instead of using GitHub Actions steps.

Changes

  • Action mode enum: Added ActionModeScript constant with validation
  • Checkout logic: Script mode checks out githubnext/gh-aw actions to /tmp/gh-aw/actions-source/ with shallow clone (depth: 1) for improved performance
  • Setup execution: Created generateSetupStep() helper that runs bash script in script mode, action step otherwise
  • Feature flag: Compiler reads action-mode from frontmatter and overrides mode
  • All setup sites: Updated 8 files where setup steps are generated
  • Consistent naming: Both dev and script modes use "Checkout actions folder" step name for consistency

Usage

Via frontmatter:

---
features:
  action-mode: "script"
---

Via CLI:

gh aw compile --action-mode=script workflow.md

Script mode generates:

- name: Checkout actions folder
  uses: actions/checkout@...
  with:
    repository: githubnext/gh-aw
    sparse-checkout: |
      actions
    path: /tmp/gh-aw/actions-source
    depth: 1
    persist-credentials: false

- name: Setup Scripts
  run: |
    bash /tmp/gh-aw/actions-source/actions/setup/setup.sh
  env:
    INPUT_DESTINATION: /opt/gh-aw/actions

Dev mode (default) generates:

- name: Checkout actions folder
  uses: actions/checkout@...
  with:
    sparse-checkout: |
      actions
    persist-credentials: false

- name: Setup Scripts
  uses: ./actions/setup
  with:
    destination: /opt/gh-aw/actions
Original prompt

Add a feature flag "action-mode: script" that enables a action deployment mode where we run a bash script instead adding the action step. This mode is similar to the action mode for developer but first, we need to checkout the githubnext/gh-aw .github folder somewhere in temp (/tmp/gh-aw/actions-source/), then run the setup.sh script from there.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 12, 2026 18:45
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add ActionModeScript constant and validation
- Update generateCheckoutActionsFolder for script mode checkout
- Create generateSetupStep helper for script vs action execution
- Add feature flag override support in compiler
- Update all setup step generation sites
- Add tests for script mode validation

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add TestScriptActionModeCompilation integration test
- Verify script mode checkout behavior
- Verify script execution instead of action usage
- Add test files to gitignore

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
All tests passing for action mode script feature:
- ActionMode validation tests ✅
- Script mode integration test ✅
- Manual compilation and verification ✅
- Code formatted and validated ✅

Feature successfully implements script mode that:
- Checks out githubnext/gh-aw actions to /tmp/gh-aw/actions-source/
- Runs setup.sh script directly with INPUT_DESTINATION env var
- Works via frontmatter feature flag or CLI --action-mode=script
- Fully tested and documented

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feature flag for action deployment mode script Add action-mode: script feature flag for bash script execution Jan 12, 2026
Copilot AI requested a review from pelikhan January 12, 2026 19:05
@pelikhan
Copy link
Contributor

@copilot use the action-script mode to the dev.md agentic workflow. make this workflow print a poem to an issue (staged mode)

- Enable script mode via features.action-mode flag
- Workflow uses script mode to checkout and run setup.sh
- Already configured for staged mode safe outputs
- Posts poems to issues as comments (preview mode)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 12, 2026

@copilot use the action-script mode to the dev.md agentic workflow. make this workflow print a poem to an issue (staged mode)

Done! Added action-mode: script to .github/workflows/dev.md in commit 83158cc.

The dev workflow now:

  • ✅ Uses script mode (checks out githubnext/gh-aw actions to /tmp/gh-aw/actions-source/)
  • ✅ Runs setup.sh directly instead of using action steps
  • ✅ Already configured with staged mode for safe outputs
  • ✅ Posts poems to issues as comments (preview mode)

The compiled workflow shows:

- name: Checkout actions source
  uses: actions/checkout@...
  with:
    repository: githubnext/gh-aw
    path: /tmp/gh-aw/actions-source

- name: Setup Scripts
  run: |
    bash /tmp/gh-aw/actions-source/actions/setup/setup.sh
  env:
    INPUT_DESTINATION: /opt/gh-aw/actions

@pelikhan
Copy link
Contributor

@copilot shallow checkout keep credentials false

- Add depth: 1 to script mode checkout for faster cloning
- Keep persist-credentials: false (already set)
- Update test to verify shallow checkout parameter
- Recompile dev.md workflow with shallow checkout

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 12, 2026

@copilot shallow checkout keep credentials false

Done! Added shallow checkout with depth: 1 and kept persist-credentials: false in commit 94eaa44.

Script mode checkout now includes:

- name: Checkout actions source
  uses: actions/checkout@...
  with:
    repository: githubnext/gh-aw
    sparse-checkout: |
      actions
    path: /tmp/gh-aw/actions-source
    depth: 1                      # ← shallow checkout
    persist-credentials: false    # ← credentials not persisted

This makes the checkout faster by only fetching the latest commit.

@pelikhan
Copy link
Contributor

@copilot recompile and make sure it uses the actions/setup from local path in compiled .lock.yml files (dev mode)

- Remove action-mode: script feature flag from dev.md
- Workflow now uses dev mode (default) with local actions/setup path
- Compiled lock file uses 'uses: ./actions/setup' instead of bash script
- Checkout uses local repository with sparse-checkout for actions folder
- Tests pass successfully

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 12, 2026

@copilot recompile and make sure it uses the actions/setup from local path in compiled .lock.yml files (dev mode)

Done! Reverted dev.md to use dev mode with local actions/setup in commit 1fe5ef5.

The dev.lock.yml now uses:

- name: Checkout actions folder
  uses: actions/checkout@...
  with:
    sparse-checkout: |
      actions
    persist-credentials: false

- name: Setup Scripts
  uses: ./actions/setup              # ← local path
  with:
    destination: /opt/gh-aw/actions

Removed the action-mode: script feature flag so it defaults to dev mode, which uses the local ./actions/setup action instead of checking out from a remote repository.

success: ${{ steps.parse_results.outputs.success }}
steps:
- name: Checkout actions folder
- name: Checkout actions source
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot revert wording change "folder" -> "source". it's not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done! Reverted the wording change in commit 528a137.

Both dev and script modes now use the same step name:

- name: Checkout actions folder    # ← consistent naming

The unnecessary "source" → "folder" distinction has been removed.

- Changed script mode checkout step name from "Checkout actions source" back to "Checkout actions folder"
- Both dev and script modes now use consistent "folder" naming
- No functional changes, only step name consistency
- Tests pass successfully

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan January 12, 2026 22:13
@pelikhan pelikhan marked this pull request as ready for review January 12, 2026 22:27
@pelikhan pelikhan merged commit 1c32af7 into main Jan 12, 2026
47 checks passed
@pelikhan pelikhan deleted the copilot/add-action-mode-script-feature branch January 12, 2026 22:27
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