Skip to content

Commit 89aae59

Browse files
authored
Merge pull request #931 from cisagov/improvement/adjust_provider_locking_workflow
Adjust the workflow that automatically locks Terraform providers
2 parents 19393eb + 4d51bfc commit 89aae59

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

.github/workflows/lock-terraform-providers.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on: # yamllint disable-line rule:truthy
66
# https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request
77
pull_request:
88
paths:
9+
# Ensure the workflow is run if it has been changed.
10+
- .github/workflows/lock-terraform-providers.yml
911
- terraform/.terraform.lock.hcl
1012

1113
# Set a default shell for any run steps. The `-Eueo pipefail` sets errtrace,
@@ -55,8 +57,10 @@ jobs:
5557
permissions_monitoring_config: ${{ vars.ACTIONS_PERMISSIONS_CONFIG }}
5658
lock-providers:
5759
# Prevent the workflow from running if the trigger was a previous workflow run that
58-
# updated the lock file.
59-
if: ${{ github.actor != 'github-actions[bot]' }}
60+
# updated the lock file or if the run is from a fork.
61+
if: >-
62+
(github.actor != 'github-actions[bot]')
63+
&& (github.event.pull_request.head.repo.full_name == github.repository)
6064
needs:
6165
- diagnostics
6266
permissions:
@@ -97,6 +101,7 @@ jobs:
97101
# Needed by stefanzweifel/git-auto-commit-action to support the pull_request
98102
# trigger.
99103
ref: ${{ github.head_ref }}
104+
token: ${{ secrets.GHA_AUTO_COMMIT_TOKEN || github.token }}
100105
- name: Setup Terraform
101106
uses: hashicorp/setup-terraform@v3
102107
with:

terraform/.terraform.lock.hcl

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)