Skip to content

Adjust the workflow that automatically locks Terraform providers#931

Merged
mcdonnnj merged 4 commits intodevelopfrom
improvement/adjust_provider_locking_workflow
Feb 23, 2026
Merged

Adjust the workflow that automatically locks Terraform providers#931
mcdonnnj merged 4 commits intodevelopfrom
improvement/adjust_provider_locking_workflow

Conversation

@mcdonnnj
Copy link
Member

🗣 Description

This pull request makes some adjustments to the lock-terraform-providers.yml workflow that automatically locks Terraform providers in pull requests. These changes include:

  • Use a GitHub Personal Access Token (PAT) if available, but fall back to the default GitHub token.
  • Do not run the workflow in pull requests from forks.
  • Run the workflow if the workflow file has been modified.

💭 Motivation and context

These are mostly quality of life changes to the functionality of the workflow, but the change to using a PAT will allow Dependabot PRs to automatically lock providers and trigger necessary workflows if a commit is pushed.

🧪 Testing

Automated tests pass. I tested similar changes in cisagov/cyhy-core#137.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All new and existing tests pass.

Provide a PAT when checking out the repository in the
`lock-terraform-providers.yml` workflow. This will allow a commit
pushed by this workflow to trigger other workflows in the repository.
Include the workflow file in the paths that trigger the
`lock-terraform-providers.yml` workflow. This will ensure that changes
to the workflow are tested if a PR that modifies the workflow file is
made.
Using the stefanzweifel/git-auto-commit-action action in workflow runs
for pull requests from a fork is too much effort for something we will
be unlikely to need.
@mcdonnnj mcdonnnj self-assigned this Feb 23, 2026
@mcdonnnj mcdonnnj added the improvement This issue or pull request will add or improve functionality, maintainability, or ease of use label Feb 23, 2026
@mcdonnnj mcdonnnj requested a review from Copilot February 23, 2026 21:15
@github-actions github-actions bot added the github-actions Pull requests that update GitHub Actions code label Feb 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request enhances the Terraform provider locking workflow with improved automation and security features. The changes enable better integration with Dependabot by using a Personal Access Token (PAT) when available, prevent execution on fork PRs for security, and ensure the workflow runs when its own configuration is modified.

Changes:

  • Added the workflow file itself to path triggers to validate workflow modifications
  • Added fork detection to prevent the workflow from running on pull requests from forked repositories
  • Implemented PAT token with fallback to default GitHub token for better workflow triggering capabilities
Files not reviewed (1)
  • terraform/.terraform.lock.hcl: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions github-actions bot added the dependencies Pull requests that update a dependency file label Feb 23, 2026
@mcdonnnj mcdonnnj enabled auto-merge February 23, 2026 21:24
@mcdonnnj mcdonnnj merged commit 89aae59 into develop Feb 23, 2026
17 checks passed
@mcdonnnj mcdonnnj deleted the improvement/adjust_provider_locking_workflow branch February 23, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file github-actions Pull requests that update GitHub Actions code improvement This issue or pull request will add or improve functionality, maintainability, or ease of use

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants