Skip to content

Add skip-plandiff option and fix workspace variable usage#89

Merged
Igor Rodionov (goruha) merged 13 commits into
mainfrom
replace-workspace-to-env-variable
Nov 21, 2025
Merged

Add skip-plandiff option and fix workspace variable usage#89
Igor Rodionov (goruha) merged 13 commits into
mainfrom
replace-workspace-to-env-variable

Conversation

@jamengual

@jamengual PePe Amengual (jamengual) commented Nov 11, 2025

Copy link
Copy Markdown
Contributor

This pull request adds support for skipping plan diff validation in the action.yml workflow, allowing users to bypass plan preparation and diff validation steps if desired. It also refactors how plan files are selected and referenced throughout the workflow, and standardizes the use of ${GITHUB_WORKSPACE} for file paths. These changes improve flexibility and maintainability of the workflow.

Plan Diff Skipping and Conditional Logic

  • Added a new input skip-plandiff to action.yml to allow skipping plan diff validation, with corresponding conditional logic throughout the workflow to support this behavior. [1] [2]
  • Introduced a new step Determine Plan File to select the appropriate plan file and filename based on whether plan diff is skipped or not, and updated downstream steps to use this output. [1] [2] [3]

File Path Standardization

  • Replaced usages of ${{ github.workspace }} with ${GITHUB_WORKSPACE} for all file output and manipulation operations, ensuring consistency and reliability in file path references. [1] [2] [3] [4] [5]

Workflow Improvements

  • Updated conditional logic for Infracost-related steps and Terraform apply to account for the new skip-plandiff input, ensuring correct execution flow when plan diff is skipped. [1] [2]
  • Added logic to conditionally set the --skip-init flag for Terraform apply, depending on whether plan diff was run.

Minor Enhancements

  • Added a conditional to the Atmos installation step so it only runs when a version is specified.

 ${{ github.workspace }} is evaluated at workflow parse time, not runtime, so it always resolves to /home/runner/_work/repo/repo regardless of where it's actually mounted in the container.
This commit introduces a new `skip-plandiff` input parameter that allows users to skip the plan diff validation step and proceed directly to terraform apply.

Changes:
- Add `skip-plandiff` input parameter (default: 'false')
- Update "Plan prepare" step to skip when skip-plandiff is enabled
- Update all dependent steps (Infracost, Apply) to pass when skip-plandiff is true
- Ensure Terraform Apply step runs when plan validation is skipped

Use case: This is useful when you want to force an apply operation without waiting for or validating plan changes, such as in emergency deployments or when plan diff validation is not required.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jamengual PePe Amengual (jamengual) changed the title Replace github.workspace with GITHUB_WORKSPACE Add skip-plandiff option and fix workspace variable usage Nov 17, 2025
This commit fixes an issue where steps would fail when skip-plandiff
is enabled because they referenced a plan file that was never created.

Problem:
- When skip-plandiff is true, the "Plan prepare" step doesn't run
- The renewed_plan_file is never created
- Subsequent steps (Convert PLANFILE to JSON, Terraform Apply) failed
  trying to reference the non-existent renewed_plan_file

Solution:
- Add "Determine Plan File" step that conditionally sets the plan file:
  * If skip-plandiff is true: use retrieved_plan_file (from storage)
  * If skip-plandiff is false: use renewed_plan_file (from plan prepare)
- Update "Convert PLANFILE to JSON" to use dynamic plan file
- Update "Terraform Apply" to use dynamic plan filename

This ensures plan-diff still works as expected while also supporting
the skip-plandiff option for emergency deployments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Problem:
- When skip-plandiff is true, the "Plan prepare" step doesn't run
- This means terraform init never executes
- But the deploy command was always using --skip-init
- This caused "Error: Backend initialization required" failures

Solution:
- Only add --skip-init flag when plan-diff actually ran
- When skip-plandiff is true, allow init to run during deploy
- Set SKIP_INIT_FLAG conditionally based on skip-plandiff input

Also removed debug line that was accidentally left in the code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@goruha Igor Rodionov (goruha) added the major Breaking changes (or first stable release) label Nov 21, 2025
@goruha Igor Rodionov (goruha) merged commit 86bfa73 into main Nov 21, 2025
19 of 23 checks passed
@goruha Igor Rodionov (goruha) deleted the replace-workspace-to-env-variable branch November 21, 2025 13:56
@github-actions

Copy link
Copy Markdown

These changes were released in v6.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Breaking changes (or first stable release)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants