Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d9f62e4
feat: add centralized action metadata system with proper array parsing
virgofx Jun 13, 2025
cc9c6ab
refactor: update config system to use centralized action metadata
virgofx Jun 13, 2025
a3c9e4e
test: improve test infrastructure and input helpers
virgofx Jun 13, 2025
d47b8a6
test: add comprehensive config validation test coverage
virgofx Jun 13, 2025
7144712
fix: resolve context test environment variable issues
virgofx Jun 13, 2025
955a183
fix: correct import paths and type inconsistencies
virgofx Jun 13, 2025
f3202d8
chore: update dependencies and action.yml defaults
virgofx Jun 13, 2025
1b72627
chore: update package dependencies to latest versions
virgofx Jun 16, 2025
341fecc
fix: remove unnecessary SSH agent forwarding and update prettier feature
virgofx Jun 16, 2025
3b26ad4
fix: update super-linter action to specific version for consistency
virgofx Jun 16, 2025
2a490b2
fix: update create-pull-request action to specific version for stability
virgofx Jun 16, 2025
b80ea3f
fix: update SonarQube scan action to specific commit SHA for stability
virgofx Jun 16, 2025
0c654e2
fix: update package dependencies to latest versions for improved stab…
virgofx Jun 19, 2025
b32f5e0
feat: support optional v prefix with directory separator config
virgofx Jun 19, 2025
6dff8a5
fix: update rollup packages to version 4.44.0 for improved compatibility
virgofx Jun 19, 2025
26b7e79
feat: enhance tag generation configuration with detailed descriptions…
virgofx Jun 19, 2025
99ee82a
fix: remove eslint directive for throwing literals in metadata tests
virgofx Aug 19, 2025
f3e2d30
chore: update dependencies
virgofx Aug 19, 2025
f2e1874
chore: update dependencies and improve variable naming
virgofx Aug 19, 2025
de13c5a
fix: update @types/node to version 22.17.2 for improved compatibility
virgofx Aug 19, 2025
88565fe
fix: update GitHub token reference for CI testing in workflow
virgofx Aug 19, 2025
9a60236
refactor: simplify ACTION_INPUTS metadata definitions using factory f…
virgofx Aug 19, 2025
d62ca15
test: enhance ACTION_INPUTS tests for metadata structure and type safety
virgofx Aug 19, 2025
8b8149e
fix: formatting
virgofx Aug 19, 2025
0bfd6ed
test: add tests for VALID_TAG_DIRECTORY_SEPARATORS, VERSION_TAG_REGEX…
virgofx Aug 19, 2025
6fe0e7c
refactor: remove redundant SonarQube job steps from workflow
virgofx Aug 19, 2025
b33ab14
feat: refactor render -> renderTemplate function and update wiki usag…
virgofx Aug 21, 2025
cc5eec2
fix: update changelog script import path in release workflow
virgofx Aug 21, 2025
f94d31c
fix: update documentation links and remove test comment in main.tf
virgofx Aug 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"markdown.extension.list.indentationSize": "adaptive",
"markdown.extension.italic.indicator": "_",
"markdown.extension.orderedList.marker": "one",
"remote.SSH.enableAgentForwarding": true,
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
Expand All @@ -53,6 +52,6 @@
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
"ghcr.io/devcontainers-community/npm-features/prettier": {}
}
}
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ jobs:
disable-wiki: false
wiki-sidebar-changelog-max: 10
delete-legacy-tags: false # Note: We don't want to delete tags in this repository
terraform-docs-version: v0.19.0
module-path-ignore: tf-modules/kms/examples/complete
terraform-docs-version: v0.20.0
module-path-ignore: tf-modules/kms/examples/complete,tf-modules/zoo,tf-modules/animal,tf-modules/s3-bucket-object
module-change-exclude-patterns: .gitignore,*.md,*.tftest.hcl,tests/**,examples/**
module-asset-exclude-patterns: .gitignore,*.md,*.tftest.hcl,tests/**
use-ssh-source-format: true
tag-directory-separator: "-"
use-version-prefix: false

- name: Test Action Outputs
id: test-outputs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

- name: Lint Codebase
id: super-linter
uses: super-linter/super-linter/slim@v7
uses: super-linter/super-linter@5119dcd8011e92182ce8219d9e9efc82f16fddb6 # v8.0.0
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
with:
result-encoding: json
script: |
const { generateChangelog } = await import('${{ github.workspace }}/.github/scripts/changelog.js');
const { generateChangelog } = await import('${{ github.workspace }}/scripts/changelog.js');

try {
const changelog = await generateChangelog("${{ env.VERSION }}");
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
}

- name: Create Branch and Pull Request
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
token: ${{ steps.app-token.outputs.token }}
base: main
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ on:
types: [opened, synchronize, reopened]

jobs:
tests:
Tests:
runs-on: ubuntu-latest
name: Test
name: TypeScript Tests
permissions:
contents: read
steps:
Expand All @@ -33,9 +33,10 @@ jobs:
- name: Run Tests Typescript
run: npm run test
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO_CI_TESTING }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Note: SonarQube requires the results from tests to get the coverage report
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
uses: SonarSource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
71 changes: 38 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,25 @@ configuring the following optional input parameters as needed.
| `delete-legacy-tags` | Specifies a boolean that determines whether tags and releases from Terraform modules that have been deleted should be automatically removed | `true` |
| `disable-wiki` | Whether to disable wiki generation for Terraform modules | `false` |
| `wiki-sidebar-changelog-max` | An integer that specifies how many changelog entries are displayed in the sidebar per module | `5` |
| `wiki-usage-template` | A raw, multi-line string to override the default 'Usage' section in the generated wiki. Allows using variables like {{module_name}}, {{latest_tag}}, {{latest_tag_version_number}} and more.<br><sub>[Read more here](#configuring-the-wiki-usage-template)</sub> | [See action.yml](https://github.com/polleuretan/terraform-module-releaser/blob/main/action.yml#L108) |
| `disable-branding` | Controls whether a small branding link to the action's repository is added to PR comments. Recommended to leave enabled to support OSS. | `false` |
| `module-path-ignore` | Comma-separated list of module paths to completely ignore. Modules matching any pattern here are excluded from all versioning, releases, and documentation.<br><sub>[Read more here](#understanding-the-filtering-options)</sub> | `` (empty string) |
| `module-change-exclude-patterns` | Comma-separated list of file patterns (relative to each module) to exclude from triggering version changes. Lets you release a module but control which files inside it do not force a version bump.<br><sub>[Read more here](#understanding-the-filtering-options)</sub> | `.gitignore,*.md,*.tftest.hcl,tests/**` |
| `module-asset-exclude-patterns` | A comma-separated list of file patterns to exclude when bundling a Terraform module for tag/release. Patterns follow glob syntax (e.g., `tests/\*\*`) and are relative to each Terraform module directory. Files matching these patterns will be excluded from the bundled output. | `.gitignore,*.md,*.tftest.hcl,tests/**` |
| `use-ssh-source-format` | If enabled, all links to source code in generated Wiki documentation will use SSH standard format (e.g., `git::ssh://[email protected]/owner/repo.git`) instead of HTTPS format (`git::https://github.com/owner/repo.git`) | `false` |
| `wiki-usage-template` | A raw, multi-line string to override the default 'Usage' section in the generated wiki. Allows using variables like {{module_name}}, {{latest_tag}}, {{latest_tag_version_number}} and more.<br><sub>[Read more here](#configuring-the-usage-template)</sub> | [See action.yml](https://github.com/polleuretan/terraform-module-releaser/blob/main/action.yml#L108) |
| `use-ssh-source-format` | If enabled, all links to source code in generated Wiki documentation will use SSH format (e.g., `git::ssh://[email protected]/owner/repo.git`) instead of HTTPS format (`git::https://github.com/owner/repo.git`) | `false` |
| `tag-directory-separator` | Character used to separate directory path components in Git tags. Supports `/`, `-`, `_`, or `.` | `/` |
| `use-version-prefix` | Whether to include the 'v' prefix on version tags (e.g., v1.2.3 vs 1.2.3) | `true` |

### Understanding the filtering options

- **`module-path-ignore`**: Completely ignores specified module paths. Any module whose path matches any pattern in this
list will not be processed at all by the action. This is useful for:

- Excluding example modules (e.g., `**/examples/**`)
- Skipping test modules (e.g., `**/test/**`)
- Ignoring documentation-focused modules (e.g., `**/docs/**`)
- Excluding entire directories or paths that contain Terraform files but shouldn't be versioned as modules

**Important pattern matching notes:**

- Patterns are relative to the workspace directory (no leading slash)
- A pattern like `dir/**` will match files and directories INSIDE `dir` but NOT the `dir` directory itself
- To match both a directory and its contents, you need both patterns: `dir,dir/**`
Expand All @@ -228,15 +228,13 @@ configuring the following optional input parameters as needed.
a new module release.

**Key details:**

- Patterns are relative to each **module directory**, not the workspace root
- Uses `matchBase: true` for pattern matching, so `*.md` will match any Markdown file in any subdirectory
- Applied only after a module is identified but before determining if it needs a version change
- Default patterns: `.gitignore, *.md, *.tftest.hcl, tests/**`
- Use this for files that should be part of the module but don't affect its functionality

**Common use cases:**

- Documentation files (`*.md`, `docs/**`)
- Test files (`tests/**`, `*.tftest.hcl`)
- Examples (`examples/**`)
Expand All @@ -254,15 +252,13 @@ configuring the following optional input parameters as needed.
are _excluded_ from the asset. This helps reduce the asset size by omitting test files, examples, documentation, etc.

**Key details:**

- Patterns are relative to each **module directory**, not the workspace root
- Uses `matchBase: true` for pattern matching (same as `module-change-exclude-patterns`)
- Applied during the bundle/archive creation phase for GitHub releases
- Default patterns: `.gitignore, *.md, *.tftest.hcl, tests/**`
- These patterns do NOT affect versioning decisions - only the contents of release assets

**Common use cases:**

- Test directories and files (`tests/**`, `*.tftest.hcl`)
- Documentation that's not needed for module functionality (`*.md`)
- Development-specific files (`.gitignore`, `CHANGELOG.md`)
Expand All @@ -282,18 +278,18 @@ similar to those used in `.gitignore` files. For more details on the pattern mat
[source code](https://github.com/techpivot/terraform-module-releaser/blob/main/src/utils/file.ts) or visit the
[minimatch documentation](https://github.com/isaacs/minimatch).

### Configuring the Usage Template
### Configuring the Wiki Usage Template

The `wiki-usage-template` input allows you to customize the "Usage" section of the generated wiki page for each module.
You can use the following dynamic variables in your template:

| Variable | Description | Example |
| ------------------------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| `{{module_name}}` | The name of the module. | `aws/s3-bucket` |
| `{{latest_tag}}` | The latest Git tag for the module. | `aws/s3-bucket/v1.2.3` |
| `{{latest_tag_version_number}}` | The version number of the latest tag. | `1.2.3` |
| `{{module_source}}` | The Git source URL for the module, respecting the `use-ssh-source-format` input. | `git::https://github.com/owner/repo.git` |
| `{{module_name_terraform}}` | A Terraform-safe version of the module name (e.g., special characters replaced with underscores). | `aws_s3_bucket` |
| Variable | Description | Example |
| ------------------------------- | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| `{{module_name}}` | The name of the module. | `aws/s3-bucket` |
| `{{latest_tag}}` | The latest Git tag for the module. | `aws/s3-bucket/v1.2.3` |
| `{{latest_tag_version_number}}` | The version number of the latest tag (Always excludes any `v` prefix) | `1.2.3` |
| `{{module_source}}` | The Git source URL for the module with `git::` prefix, respecting the `use-ssh-source-format` input. | `git::ssh://github.com/techpivot/terraform-module-releaser.git` |
| `{{module_name_terraform}}` | A Terraform-safe version of the module name (e.g., special characters replaced with underscores). | `aws_s3_bucket` |

### Example Usage with Inputs

Expand Down Expand Up @@ -323,29 +319,31 @@ jobs:
minor-keywords: feat,feature
patch-keywords: fix,chore,docs
default-first-tag: v1.0.0
terraform-docs-version: v0.19.0
terraform-docs-version: v0.20.0
delete-legacy-tags: true
disable-wiki: false
wiki-sidebar-changelog-max: 10
module-path-ignore: path/to/ignore1,path/to/ignore2
module-change-exclude-patterns: .gitignore,*.md,docs/**,examples/**,*.tftest.hcl,tests/**
module-asset-exclude-patterns: .gitignore,*.md,*.tftest.hcl,tests/**
use-ssh-source-format: false
use-ssh-source-format: true
tag-directory-separator: /
use-version-prefix: true
wiki-usage-template: |
# My Custom Usage Instructions

This is a custom usage block.

You can add any markdown you want here.
This is a custom wiki usage block that supports markdown.

And use variables like {{module_name}}, {{latest_tag}}, {{latest_tag_version_number}},
{{module_source}} and {{module_name_terraform}}.
The following variables are supported:
- {{module_name}}
- {{latest_tag}}
- {{latest_tag_version_number}}
- {{module_source}}
- {{module_name_terraform}}

```hcl
module "{{module_name_terraform}}" {
source = "{{module_source}}?ref={{latest_tag}}"
version = "{{latest_tag_version_number}}"
# ...
source = "{{module_source}}?ref={{latest_tag}}"

# See inputs below for additional required parameters
}
```
````
Expand All @@ -367,6 +365,8 @@ The following outputs are available from this action:

```json
{
"changed-module-names": ["aws/vpc"],
"changed-module-paths": ["/home/runner/work/terraform-module-releaser/terraform-module-releaser/aws/vpc"],
"changed-modules-map": {
"aws/vpc": {
"path": "modules/aws/vpc",
Expand All @@ -375,16 +375,21 @@ The following outputs are available from this action:
"releaseType": "minor"
}
},
"all-module-names": ["aws/s3", "aws/vpc"],
"all-module-paths": [
"/home/runner/work/terraform-module-releaser/terraform-module-releaser/aws/s3",
"/home/runner/work/terraform-module-releaser/terraform-module-releaser/aws/vpc"
],
"all-modules-map": {
"aws/vpc": {
"path": "modules/aws/vpc",
"latestTag": "aws/vpc/v1.0.0",
"latestTagVersion": "v1.0.0"
},
"aws/s3": {
"path": "modules/aws/s3",
"latestTag": "aws/s3/v2.1.0",
"latestTagVersion": "v2.1.0"
},
"aws/vpc": {
"path": "modules/aws/vpc",
"latestTag": "aws/vpc/v1.0.0",
"latestTagVersion": "v1.0.0"
}
}
}
Expand Down
Loading