Skip to content

Commit d05aefa

Browse files
committed
refactor: rename handleWikiOperations to handleReleasePlanComment for clarity
1 parent 8cc8db1 commit d05aefa

File tree

3 files changed

+30
-21
lines changed

3 files changed

+30
-21
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,36 @@ jobs:
5959
echo "Testing action outputs..."
6060
6161
# Test if outputs are set
62-
if [[ -n "${{ steps.test-action.outputs.changed_module_names }}" ]]; then
63-
echo "✅ Changed module names: ${{ steps.test-action.outputs.changed_module_names }}"
62+
if [[ -n "${{ steps.test-action.outputs.changed-module-names }}" ]]; then
63+
echo "✅ Output 'changed-modules-names': ${{ steps.test-action.outputs.changed-module-names }}"
6464
else
6565
echo "❌ No changed module names found"
6666
fi
6767
68-
if [[ -n "${{ steps.test-action.outputs.changed_module_paths }}" ]]; then
69-
echo "✅ Changed module paths: ${{ steps.test-action.outputs.changed_module_paths }}"
68+
if [[ -n "${{ steps.test-action.outputs.changed-module-paths }}" ]]; then
69+
echo "✅ Output 'changed-module-paths': ${{ steps.test-action.outputs.changed-module-paths }}"
7070
else
7171
echo "❌ No changed module paths found"
7272
fi
7373
74-
if [[ -n "${{ steps.test-action.outputs.changed_modules_map }}" ]]; then
75-
echo "✅ Changed modules map:"
76-
echo "${{ steps.test-action.outputs.changed_modules_map }}"
74+
if [[ -n "${{ steps.test-action.outputs.changed-modules-map }}" ]]; then
75+
echo "✅ Output 'changed-modules-map':"
76+
echo '${{ steps.test-action.outputs.changed-modules-map }}' | jq -r '
77+
"Found \(length) changed module(s):",
78+
(to_entries[] |
79+
"• \(.key):",
80+
" - Path: \(.value.path)",
81+
" - Current Tag: \(.value.currentTag)",
82+
" - Next Tag: \(.value.nextTag)",
83+
" - Release Type: \(.value.releaseType)"
84+
)
85+
'
7786
else
7887
echo "❌ No changed modules map found"
7988
fi
80-
81-
# Validate JSON format of changed_modules_map
82-
if ! echo "${{ steps.test-action.outputs.changed_modules_map }}" | jq '.' >/dev/null 2>&1; then
83-
echo "❌ Changed modules map is not valid JSON"
89+
90+
# Silently validate JSON structure is an object
91+
echo '${{ steps.test-action.outputs.changed-modules-map }}' | jq -e 'type == "object"' > /dev/null || {
92+
echo "❌ Expected object type in changed-modules-map"
8493
exit 1
85-
fi
94+
}

.node-version

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
22
2-
# Used by CI only
1+
22

src/main.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type {
1414
TerraformModule,
1515
} from '@/types';
1616
import { WikiStatus, checkoutWiki, commitAndPushWikiChanges, generateWikiFiles } from '@/wiki';
17-
import { info, setFailed, setOutput } from '@actions/core';
17+
import { endGroup, info, setFailed, setOutput, startGroup } from '@actions/core';
1818

1919
/**
2020
* Initializes and returns the configuration and context objects.
@@ -37,7 +37,7 @@ function initialize(): { config: Config; context: Context } {
3737
* @param {string[]} terraformModuleNamesToRemove - List of Terraform module names to remove.
3838
* @returns {Promise<void>} Resolves when wiki-related operations are completed.
3939
*/
40-
async function handleWikiOperations(
40+
async function handleReleasePlanComment(
4141
config: Config,
4242
terraformChangedModules: TerraformChangedModule[],
4343
terraformModuleNamesToRemove: string[],
@@ -129,7 +129,7 @@ export async function run(): Promise<void> {
129129
const terraformModuleNamesToRemove = getTerraformModulesToRemove(allTags, terraformModules);
130130

131131
if (!context.isPrMergeEvent) {
132-
await handleWikiOperations(config, terraformChangedModules, terraformModuleNamesToRemove);
132+
await handleReleasePlanComment(config, terraformChangedModules, terraformModuleNamesToRemove);
133133
} else {
134134
await handleMergeEvent(
135135
config,
@@ -154,14 +154,15 @@ export async function run(): Promise<void> {
154154
);
155155

156156
// Log the changes for debugging
157+
startGroup('Outputs');
157158
info(`Changed module names: ${JSON.stringify(changedModuleNames)}`);
158159
info(`Changed module paths: ${JSON.stringify(changedModulePaths)}`);
159160
info(`Changed modules map: ${JSON.stringify(changedModulesMap, null, 2)}`);
161+
endGroup();
160162

161-
162-
setOutput('changed_module_names', changedModuleNames);
163-
setOutput('changed_module_paths', changedModulePaths);
164-
setOutput('changed_modules_map', changedModulesMap);
163+
setOutput('changed-module-names', changedModuleNames);
164+
setOutput('changed-module-paths', changedModulePaths);
165+
setOutput('changed-modules-map', changedModulesMap);
165166
} catch (error) {
166167
if (error instanceof Error) {
167168
setFailed(error.message);

0 commit comments

Comments
 (0)