2.4 KiB
StackitGit Actions: Manual Approvals Guide
While StackitGit Actions does not currently feature native environment protection rules that pause a running workflow for a UI approval, the most effective and resource-efficient workaround is to split your CI/CD pipeline into separate workflows using the workflow_dispatch event.
Resource Efficiency (Cost Savings): Unlike workarounds that use third-party actions to poll for comments on an Issue, splitting workflows is significantly cheaper and more efficient. Pause-and-poll methods keep the original workflow active, holding the runner hostage and consuming compute minutes for hours or days while waiting for an approval. By splitting workflows, the runner is immediately freed after the build phase. A new runner is only provisioned when the deployment is explicitly approved.
Step 1: The Automated Build & Test Workflow
Create your primary workflow that runs automatically on every push or pull request. This workflow handles everything up to the point of deployment.
name: 1. Build and Test
on: [push]
jobs:
build:
runs-on: stackit-ubuntu-22
steps:
- uses: actions/checkout@v4
- name: Run tests
run: echo "Testing the code..."
- name: Build artifact
run: echo "Building artifact..."
# Upload artifacts here for the deploy workflow to download
Step 2: The Manual Deployment Workflow
Create a second workflow triggered only by workflow_dispatch. This generates a "Run Workflow" button in the StackitGit UI, serving as your manual approval gate.
name: 2. Manual Production Deploy
on:
workflow_dispatch:
inputs:
version:
description: 'Version or Branch to deploy'
required: true
default: 'main'
jobs:
deploy:
runs-on: stackit-ubuntu-22
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.version }}
- name: Deploy to Production
run: echo "Deploying version ${{ github.event.inputs.version }}..."
Workflow Execution
- A developer pushes code, triggering the Build and Test workflow automatically.
- The team reviews the workflow results and test logs. The runner completes its job, reports success, and shuts down.
- When the release is approved, an authorized team member navigates to the StackitGit Actions tab, selects the Manual Production Deploy workflow, and clicks "Run Workflow".