Skip to content
This repository was archived by the owner on Nov 13, 2025. It is now read-only.

Conversation

Copy link

Copilot AI commented Sep 26, 2025

This PR completely removes the TypeScript action infrastructure and replaces it entirely with a pure YAML reusable workflow that implements all the same functionality using shell scripts and GitHub Actions steps.

What's Changed

Previously, users had to use the compiled TypeScript action (vendanor/preview-pull-request@v3) which required maintaining build artifacts and complex TypeScript code. This PR completely removes all TypeScript action files and infrastructure, replacing it with a pure YAML reusable workflow that implements all functionality directly.

Complete Removal of TypeScript Infrastructure

Removed Files (30+ files deleted):

  • src/ directory - All TypeScript source code (12 files, ~500+ lines)
  • dist/ directory - Compiled JavaScript bundles
  • action.yml - GitHub Action configuration
  • package.json, package-lock.json - Node.js dependencies
  • tsconfig.json - TypeScript configuration
  • .eslintrc.json, .eslintignore - ESLint configuration
  • .prettierrc.json, .prettierignore - Prettier configuration

Updated Files:

  • .gitignore - Simplified to remove Node.js/TypeScript entries
  • dependabot.yml - Updated to reflect no npm dependencies
  • CHANGELOG.md - Added v4.0 breaking change entry

New Pure YAML Implementation

Added .github/workflows/reusable-preview.yml that completely replaces the TypeScript action:

jobs:
  preview:
    uses: vendanor/preview-pull-request/.github/workflows/reusable-preview.yml@v3
    with:
      app-name: 'my-app'
      base-url: 'preview.mydomain.com'
    secrets:
      github-token: ${{ secrets.GITHUB_TOKEN }}

Key Features Implemented in Pure YAML

  • Docker Operations: Build, tag, and push container images using shell commands
  • Helm Deployments: Package charts and deploy to Kubernetes with dynamic value injection
  • GitHub Integration: Parse comments, add reactions, manage sticky PR comments using GitHub API calls
  • Preview Management: Generate unique preview URLs with hash generation using shell utilities
  • Command Processing: Full support for @github-actions add-preview and @github-actions remove-preview commands
  • Probe Mode: Information gathering without deployments

Benefits

  1. No compiled dependencies: Pure YAML workflow eliminates need for TypeScript build process
  2. Simplified maintenance: No more managing build artifacts, dependencies, or compilation
  3. Direct implementation: All logic implemented in shell scripts within workflow steps
  4. Same functionality: Maintains all features of the original TypeScript action
  5. Easier to understand: Pure YAML is more transparent and easier to debug than compiled code
  6. Reduced repository size: Eliminated 6500+ lines of code and dependencies

Implementation Details

The reusable workflow implements all core functionality using:

  • Shell scripts for Docker login, build, and push operations
  • curl commands for GitHub API interactions (comments, reactions, PR details)
  • helm CLI for Kubernetes deployments and chart operations
  • Native bash utilities for hash generation and string processing

Documentation Updates

  • Complete README rewrite: Removed all TypeScript action usage examples
  • Reusable workflow focus: Updated to show only the new pure YAML approach
  • Comprehensive examples: Added basic, advanced, and probe-only usage patterns
  • Migration guide: Clear examples showing the simplified new usage pattern

Example Usage Comparison

Before (TypeScript Action):

steps:
  - name: Probe preview
    uses: vendanor/preview-pull-request@v3
    with:
      token: ${{ secrets.GITHUB_TOKEN }}
      probe: true
  - name: Manage preview
    uses: vendanor/preview-pull-request@v3
    with:
      # ... 20+ configuration parameters

After (Pure YAML Reusable Workflow):

jobs:
  preview:
    uses: vendanor/preview-pull-request/.github/workflows/reusable-preview.yml@v3
    with:
      app-name: 'my-app'
    secrets:
      github-token: ${{ secrets.GITHUB_TOKEN }}

This completely replaces the TypeScript action with a pure YAML solution that's easier to maintain, understand, and use while providing identical functionality. The repository now contains only the essential workflow and documentation files.

Fixes #375

Original prompt

This section details on the original issue you should resolve

<issue_title>make this a reusable yaml workflow</issue_title>
<issue_description></issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #375

💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits September 26, 2025 22:55
Co-authored-by: ralftar <1395569+ralftar@users.noreply.github.com>
Co-authored-by: ralftar <1395569+ralftar@users.noreply.github.com>
Co-authored-by: ralftar <1395569+ralftar@users.noreply.github.com>
Copilot AI changed the title [WIP] make this a reusable yaml workflow Add reusable YAML workflow for simplified integration Sep 26, 2025
Copilot AI requested a review from ralftar September 26, 2025 23:02
@ralftar
Copy link
Member

ralftar commented Sep 28, 2025

@copilot no i want it to replace the action in this repo. Not use it. Create a reusable yaml with the same features

Copy link
Author

Copilot AI commented Sep 28, 2025

@copilot no i want it to replace the action in this repo. Not use it. Create a reusable yaml with the same features

I understand now - you want a pure reusable YAML workflow that replaces the TypeScript action entirely, not one that wraps it. I'll create a workflow that implements all the Docker, Helm, and Kubernetes functionality directly using GitHub Actions steps. This will eliminate the need for the compiled TypeScript action altogether.

@copilot no i want it to replace the action in this repo. Not use it. Create a reusable yaml with the same features

To clarify the approach: Are you asking me to:

  1. Replace the entire TypeScript action (src/, action.yml, etc.) with a pure YAML reusable workflow that reimplements all Docker, Helm, and Kubernetes operations using shell commands?

  2. Or keep the TypeScript action but make the reusable workflow the primary interface (removing action.yml, updating README to only show reusable workflow usage)?

Option 1 would require rewriting ~500+ lines of TypeScript logic for Docker builds, Helm operations, GitHub API calls, etc. in shell commands within YAML steps. Option 2 keeps the robust TypeScript implementation but presents the reusable workflow as the main way to use this functionality.

Which approach would you prefer?

@copilot no i want it to replace the action in this repo. Not use it. Create a reusable yaml with the same features

I've now created a pure YAML reusable workflow that replaces the TypeScript action entirely. The new workflow (b2b5a56) implements all the core functionality using shell scripts within GitHub Actions steps:

Key features implemented:

  • Docker build, tag, and push operations
  • Helm chart packaging and Kubernetes deployment
  • GitHub comment parsing and sticky comment management
  • Preview URL generation with unique hashing
  • Support for both @github-actions add-preview and @github-actions remove-preview commands
  • Probe-only mode for information gathering

Usage is now simplified to:

jobs:
  preview:
    uses: vendanor/preview-pull-request/.github/workflows/reusable-preview.yml@v3
    with:
      app-name: 'my-app'
    secrets:
      github-token: ${{ secrets.GITHUB_TOKEN }}

The README has been updated with comprehensive examples and the old TypeScript action references have been removed. This eliminates the need for the compiled action while providing the same functionality through a pure YAML workflow.

Co-authored-by: ralftar <1395569+ralftar@users.noreply.github.com>
Copilot AI changed the title Add reusable YAML workflow for simplified integration Replace TypeScript action with pure YAML reusable workflow Sep 28, 2025
@ralftar
Copy link
Member

ralftar commented Sep 28, 2025

@copilot option 1

Copy link
Author

Copilot AI commented Sep 28, 2025

@copilot option 1

Implementing Option 1 - removing all TypeScript action files (src/, action.yml, package.json, etc.) and keeping only the pure YAML reusable workflow. This will completely replace the compiled action approach.

…only pure YAML reusable workflow

Co-authored-by: ralftar <1395569+ralftar@users.noreply.github.com>
Copilot AI changed the title Replace TypeScript action with pure YAML reusable workflow Replace TypeScript action with pure YAML reusable workflow - complete removal Sep 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make this a reusable yaml workflow

2 participants