@@ -24,25 +24,39 @@ jobs:
2424 const commentBody = context.payload.comment.body;
2525 const commandPrefix = "/bump ";
2626 let commandName = "";
27- let commandArgs = "";
27+ let chartName = "";
28+ let bumpLevel = "";
2829
2930 if (commentBody.startsWith(commandPrefix)) {
3031 commandName = "bump";
3132 const args = commentBody.slice(commandPrefix.length).trim().split(" ");
32- commandArgs = args[0] || "patch";
33+
34+ if (args.length > 0 && args[0]) {
35+ chartName = args[0];
36+ bumpLevel = args[1] || "patch";
37+
38+ console.log(`Chart Name: ${chartName}, Bump Level: ${bumpLevel}`);
39+ console.log(`Args array: ${JSON.stringify(args)}`);
40+
41+ const fs = require('fs');
42+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `chart-name=${chartName}\n`);
43+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `bump-level=${bumpLevel}\n`);
44+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `command-name=${commandName}\n`);
45+
46+ } else {
47+ commandName = "";
48+ core.warning("No chart name provided. Format: /bump <chart-name> [level]");
49+ }
3350 }
3451
35- core.setOutput("command-name", commandName);
36- core.setOutput("command-arguments", commandArgs);
37-
3852 - name : Add eyes reaction
3953 if : steps.command.outputs.command-name == 'bump'
4054 uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
4155 with :
4256 token : ${{ secrets.GITHUB_TOKEN }}
4357 repository : ${{ github.repository }}
4458 comment-id : ${{ github.event.comment.id }}
45- reaction-type : eyes
59+ reactions : eyes
4660
4761 - uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
4862 if : steps.command.outputs.command-name == 'bump'
@@ -83,20 +97,20 @@ jobs:
8397 id : get_version
8498 uses : mikefarah/yq@f03c9dc599c37bfcaf533427211d05e51e6fee64 # v4.47.1
8599 with :
86- cmd : yq ".version" charts/backstage /Chart.yaml
100+ cmd : yq ".version" charts/${{ steps.command.outputs.chart-name }} /Chart.yaml
87101
88- - uses : actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1
102+ - uses : actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1
89103 if : steps.command.outputs.command-name == 'bump'
90104 id : semver
91105 with :
92106 current_version : ${{ steps.get_version.outputs.result }}
93- level : ${{ steps.command.outputs.command-arguments }}
107+ level : ${{ steps.command.outputs.bump-level }}
94108
95109 - name : Bump the version
96110 if : steps.command.outputs.command-name == 'bump'
97111 uses : mikefarah/yq@f03c9dc599c37bfcaf533427211d05e51e6fee64 # v4.47.1
98112 with :
99- cmd : yq -i '.version = "${{ steps.semver.outputs.new_version }}"' charts/backstage /Chart.yaml
113+ cmd : yq -i '.version = "${{ steps.semver.outputs.new_version }}"' charts/${{ steps.command.outputs.chart-name }} /Chart.yaml
100114
101115 - name : Run pre-commit
102116 if : steps.command.outputs.command-name == 'bump'
@@ -111,8 +125,8 @@ jobs:
111125 if : steps.command.outputs.command-name == 'bump'
112126 uses : stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6
113127 with :
114- commit_message : Bump version to ${{ steps.semver.outputs.new_version }}
115- commit_options : ' -s '
128+ commit_message : Bump ${{ steps.command.outputs.chart-name }} version to ${{ steps.semver.outputs.new_version }}
129+ commit_options : " -s "
116130 commit_user_name : RHDH Bot
117- commit_user_email : 146280956+rhdh-bot@users.noreply.github.com
131+ commit_user_email : 146280956+rhdh-bot@users.noreply.github.com
118132 commit_author : RHDH Bot <146280956+rhdh-bot@users.noreply.github.com >
0 commit comments