Skip to content

Commit

Permalink
fix: resolve path gathering for templated files (#119)
Browse files Browse the repository at this point in the history
* fix: resolve path gathering for templated files

If we are modifying template files, we need to present back the parent dir
so we can run plan's against the module that has had its template changed.

Example:

terraform/modules/kubernetes/helm-config/grafana.tpl
We need to tell github that we have changed the kubernetes module
so we can run plan accordingly

* chore: fix bad import

* chore: build

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
SamTealeDrest and github-actions[bot] authored Mar 4, 2022
1 parent 781adfe commit d0776ee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parse } from 'path'
import { parse, resolve } from 'path'
import { context, getOctokit } from '@actions/github'
import {
PullRequestEvent,
Expand Down Expand Up @@ -67,7 +67,7 @@ export function getModulePaths<T extends Record<string, unknown>>(
if (ext === '.tf' || base === '.terraform.lock.hcl') {
paths.push(dir)
} else if (ext.match(/ya?ml/) !== null || ext === '.tpl') {
paths.push(dir.toString().split('/').at(-2)!)
paths.push(resolve(dir, '..'))
}
return paths
}, [])
Expand Down

0 comments on commit d0776ee

Please sign in to comment.