Skip to content

183 semver pattern without v prefix #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
4 changes: 1 addition & 3 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 @@ -52,7 +51,6 @@
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
},
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers-contrib/features/prettier:1": {}
"ghcr.io/devcontainers-community/npm-features/prettier": {}
}
}
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
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@12150456a73e248bdc94d0794898f94e23127c88 # v7.4.0
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-start.yml
Original file line number Diff line number Diff line change
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
26 changes: 23 additions & 3 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:
typescript-tests:
runs-on: ubuntu-latest
name: Test
name: TypeScript Tests
permissions:
contents: read
steps:
Expand All @@ -35,7 +35,27 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_REPO_CI_TESTING }}

sonarqube-scan:
runs-on: ubuntu-latest
name: SonarQube Analysis
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
# Disabling shallow clone is recommended for improving relevancy of reporting
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm

- name: Install Dependencies
run: npm ci --no-fund

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
uses: SonarSource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ configuring the following optional input parameters as needed.
| `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` |
| `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

Expand Down
49 changes: 16 additions & 33 deletions __mocks__/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { setupTestInputs } from '@/tests/helpers/inputs';
import type { Config } from '@/types';
import type { ActionInputMetadata } from '@/types';
import { ACTION_INPUTS, createConfigFromInputs } from '@/utils/metadata';

/**
* Configuration interface with added utility methods
Expand All @@ -9,44 +12,24 @@ interface ConfigWithMethods extends Config {
}

/**
* Default configuration object.
* Load default configuration from action.yml.
*/
const defaultConfig: Config = {
majorKeywords: ['BREAKING CHANGE', '!', 'MAJOR CHANGE'],
minorKeywords: ['feat', 'feature'],
patchKeywords: ['fix', 'chore'],
defaultFirstTag: 'v1.0.0',
terraformDocsVersion: 'v0.20.0',
deleteLegacyTags: false,
disableWiki: false,
wikiSidebarChangelogMax: 10,
disableBranding: false,
modulePathIgnore: ['tf-modules/kms/examples/complete'],
moduleChangeExcludePatterns: ['.gitignore', '*.md'],
moduleAssetExcludePatterns: ['tests/**', 'examples/**'],
githubToken: 'ghp_test_token_2c6912E7710c838347Ae178B4',
useSSHSourceFormat: false,
const createDefaultConfig = (): Config => {
setupTestInputs();
return createConfigFromInputs();
};

/**
* Valid configuration keys.
* Default configuration object loaded from action.yml.
*/
const validConfigKeys = [
'majorKeywords',
'minorKeywords',
'patchKeywords',
'defaultFirstTag',
'terraformDocsVersion',
'deleteLegacyTags',
'disableWiki',
'wikiSidebarChangelogMax',
'disableBranding',
'modulePathIgnore',
'moduleChangeExcludePatterns',
'moduleAssetExcludePatterns',
'githubToken',
'useSSHSourceFormat',
] as const;
const defaultConfig: Config = createDefaultConfig();

/**
* Valid configuration keys derived from ACTION_INPUTS.
*/
const validConfigKeys = (Object.values(ACTION_INPUTS) as ActionInputMetadata[]).map(
(metadata) => metadata.configKey,
) as Array<keyof Config>;

type ValidConfigKey = (typeof validConfigKeys)[number];

Expand Down
6 changes: 5 additions & 1 deletion __tests__/_setup.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { setupTestInputs } from '@/tests/helpers/inputs';
import { afterEach, beforeEach, vi } from 'vitest';

// Mocked node modules (./__mocks__/*)
Expand All @@ -20,11 +21,14 @@ const defaultEnvironmentVariables = {
};

beforeEach(() => {
// Initialize environment
// Initialize GitHub mock pull request environment
for (const [key, value] of Object.entries(defaultEnvironmentVariables)) {
vi.stubEnv(key, value);
}

// Set up action input defaults for testing
setupTestInputs();

// Clear all mocked functions usage data and state
vi.clearAllMocks();
});
Expand Down
Loading