Skip to content

chore: Updating README.md #4

chore: Updating README.md

chore: Updating README.md #4

name: Pipelines Execute
run-name: Run Gruntwork Pipelines
on:
workflow_call:
secrets:
PIPELINES_READ_TOKEN:
required: true
env:
PIPELINES_CLI_VERSION: 0.9.3
jobs:
detect_changes:
name: Detect Infrastructure Changes
runs-on: ubuntu-latest
steps:
- name: Preflight Checks
uses: gruntwork-io/[email protected]
with:
PIPELINES_READ_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }}
- name: Pipelines Orchestrate
id: orchestrate
uses: [email protected]
with:
token: ${{ secrets.PIPELINES_READ_TOKEN || secrets.GITHUB_TOKEN }}
outputs:
pipelines_jobs: ${{ steps.orchestrate.outputs.jobs }}
pipelines_cli_version: ${{ steps.orchestrate.outputs.pipelines_cli_version }}
pipelines_determine:
name: ${{ matrix.jobs.ChangeType }} - ${{ matrix.jobs.WorkingDirectory }}
needs: [detect_changes]
runs-on: ubuntu-latest
# GHA can't check for length, so we just check if there is an item in the 0 index
if: fromJson(needs.detect_changes.outputs.pipelines_jobs)[0] != null
strategy:
fail-fast: false
matrix:
jobs: ${{ fromJson(needs.detect_changes.outputs.pipelines_jobs) }}
steps:
- name: Check out repo code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bootstrap Workflow
id: bootstrap
uses: gruntwork-io/[email protected]
with:
token: ${{ secrets.PIPELINES_READ_TOKEN }}
change_type: ${{ matrix.jobs.ChangeType }}
branch: ${{ matrix.jobs.Ref }}
working_directory: ${{ matrix.jobs.WorkingDirectory }}
account_id: ${{ matrix.jobs.AccountId }}
terragrunt_command: ${{ matrix.jobs.Action.Command }} ${{ matrix.jobs.Action.Args }}
additional_data: ${{ toJson(matrix.jobs.AdditionalData) }}
child_account_id: ${{ matrix.jobs.AdditionalData.ChildAccountId }}
account_names: ${{ matrix.jobs.AdditionalData.AccountNames }}
- name: "Run terragrunt ${{ steps.bootstrap.outputs.terragrunt_command }} in ${{ steps.bootstrap.outputs.working_directory }}"
id: terragrunt
uses: gruntwork-io/[email protected]
with:
PIPELINES_READ_TOKEN: ${{ secrets.PIPELINES_READ_TOKEN }}
account_id: ${{ steps.bootstrap.outputs.account_id }}
account_role_name: ${{ steps.bootstrap.outputs.role_name }}
role_session_name: ${{ steps.bootstrap.outputs.role_session_name }}
working_directory: ${{ steps.bootstrap.outputs.working_directory }}
gruntwork_context: ${{ toJson(steps.bootstrap.outputs) }}
- name: Update comment
if: always()
uses: gruntwork-io/[email protected]
with:
step_name: ${{ matrix.jobs.ChangeType }}
step_working_directory: ${{ matrix.jobs.WorkingDirectory }}
step_status: ${{ steps.terragrunt.conclusion == 'success' && 'success' || 'failed' }}
step_details: ${{ steps.terragrunt.outputs.formatted_plan_output || steps.terragrunt.outputs.execute_stdout || 'Unable to determine output. Check the logs for more details.' }}
step_details_extended: ${{ steps.terragrunt.outputs.execute_stdout }}
pull_request_number: ${{ steps.bootstrap.outputs.pr_number }}
outputs:
account_id: ${{ matrix.jobs.AccountId }}
branch: ${{ steps.bootstrap.outputs.branch }}
action: ${{ steps.bootstrap.outputs.action }}
working_directory: ${{ steps.bootstrap.outputs.working_directory }}
terragrunt_command: ${{ steps.bootstrap.outputs.terragrunt_command }}
additional_data: ${{ steps.bootstrap.outputs.additional_data }}
child_account_id: ${{ steps.bootstrap.outputs.child_account_id }}