1- name : " JAIPilot Generate and Commit "
2- description : " Run jaipilot generate for changed non-test Java classes and commit generated tests back to the same branch."
1+ name : " JAIPilot Test Generation "
2+ description : " Automatically generate tests for changed Java production classes and commit the resulting updates to the current branch."
33author : " JAIPilot"
44
55branding :
6- icon : " check-circle "
7- color : " green "
6+ icon : " cpu "
7+ color : " blue "
88
99inputs :
1010 working-directory :
11- description : " Directory where JAIPilot should run ."
11+ description : " Project directory in which JAIPilot runs ."
1212 required : false
1313 default : " ."
1414 java-version :
15- description : " Temurin Java version to install."
15+ description : " Temurin Java version to install before running JAIPilot ."
1616 required : false
1717 default : " 21"
1818 install-script-url :
19- description : " Installer script URL for JAIPilot ."
19+ description : " JAIPilot installer script URL."
2020 required : false
2121 default : " https://jaipilot.com/install.sh"
2222 jaipilot-license-key :
23- description : " JAIPILOT_LICENSE_KEY used for backend-assisted generate ."
23+ description : " License key used to authenticate JAIPilot generation ."
2424 required : false
2525 default : " "
2626 fail-on-generate-error :
27- description : " If true, fail the workflow when one or more classes fail generation ."
27+ description : " Fail the workflow if generation fails for one or more classes."
2828 required : false
2929 default : " true"
3030 commit-message :
31- description : " Commit message used for generated test changes."
31+ description : " Commit message for generated test changes."
3232 required : false
33- default : " chore: jaipilot generate tests"
33+ default : " chore: generate tests with JAIPilot "
3434 git-user-name :
35- description : " Git author name used for the generated commit."
35+ description : " Git author name for the generated commit."
3636 required : false
3737 default : " github-actions[bot]"
3838 git-user-email :
39- description : " Git author email used for the generated commit."
39+ description : " Git author email for the generated commit."
4040 required : false
4141 default : " 41898282+github-actions[bot]@users.noreply.github.com"
4242
4343outputs :
4444 processed-classes :
45- description : " Number of changed non-test Java classes processed."
45+ description : " Number of changed Java production classes processed."
4646 value : ${{ steps.generate.outputs.processed-classes }}
4747 failed-classes :
48- description : " Number of changed classes that failed generation."
48+ description : " Number of classes for which generation failed ."
4949 value : ${{ steps.generate.outputs.failed-classes }}
5050 commit-sha :
51- description : " Commit SHA pushed by this action. Empty when no changes were committed."
51+ description : " Commit SHA pushed by this action. Empty if no changes were committed."
5252 value : ${{ steps.commit.outputs.commit-sha }}
5353
5454runs :
6767 curl -fsSL "${{ inputs.install-script-url }}" | bash
6868 echo "${HOME}/.local/bin" >> "${GITHUB_PATH}"
6969
70- - name : Run jaipilot generate for changed non-test Java classes
70+ - name : Generate tests for changed Java production classes
7171 id : generate
7272 shell : bash
7373 run : |
@@ -82,15 +82,15 @@ runs:
8282
8383 if [ -n "${{ inputs.jaipilot-license-key }}" ]; then
8484 export JAIPILOT_LICENSE_KEY="${{ inputs.jaipilot-license-key }}"
85- # jaipilot generate reads JAIPILOT_JWT_TOKEN today; map license key input to it.
8685 export JAIPILOT_JWT_TOKEN="${{ inputs.jaipilot-license-key }}"
8786 fi
87+
8888 if [ -n "${JAIPILOT_LICENSE_KEY:-}" ] && [ -z "${JAIPILOT_JWT_TOKEN:-}" ]; then
89- # Allow callers to provide JAIPILOT_LICENSE_KEY directly at workflow level.
9089 export JAIPILOT_JWT_TOKEN="${JAIPILOT_LICENSE_KEY}"
9190 fi
91+
9292 if [ -z "${JAIPILOT_JWT_TOKEN:-}" ]; then
93- echo "Missing JAIPILOT_LICENSE_KEY. Set input 'jaipilot-license-key' or JAIPILOT_LICENSE_KEY env var ." >&2
93+ echo "Missing JAIPILOT_LICENSE_KEY. Set the 'jaipilot-license-key' input or define JAIPILOT_LICENSE_KEY as an environment variable ." >&2
9494 exit 1
9595 fi
9696
@@ -105,7 +105,7 @@ runs:
105105 if git rev-parse --verify HEAD~1 >/dev/null 2>&1; then
106106 changed_files="$(git diff --name-only HEAD~1 HEAD)"
107107 else
108- echo "No previous commit found; using all tracked files in current commit."
108+ echo "No previous commit found; using all tracked files in the current commit."
109109 changed_files="$(git ls-files)"
110110 fi
111111 fi
@@ -133,7 +133,7 @@ runs:
133133 done
134134
135135 if [ "${#filtered_java_files[@]}" -eq 0 ]; then
136- echo "No changed non-test Java classes found."
136+ echo "No changed Java production classes found."
137137 echo "processed-classes=0" >> "${GITHUB_OUTPUT}"
138138 echo "failed-classes=0" >> "${GITHUB_OUTPUT}"
139139 echo "JAIPILOT_GENERATE_FAILED=0" >> "${GITHUB_ENV}"
@@ -144,7 +144,7 @@ runs:
144144 printf '%s\n' "${filtered_java_files[@]}" | LC_ALL=C sort -u
145145 )
146146
147- echo "Changed non-test Java classes to process:"
147+ echo "Changed Java production classes to process:"
148148 printf ' - %s\n' "${java_files[@]}"
149149
150150 processed=0
@@ -192,20 +192,20 @@ runs:
192192
193193 target_branch="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-}}"
194194 if [ -z "$target_branch" ]; then
195- echo "Unable to detect target branch (GITHUB_HEAD_REF/GITHUB_REF_NAME empty)." >&2
195+ echo "Unable to detect target branch (GITHUB_HEAD_REF/GITHUB_REF_NAME is empty)." >&2
196196 exit 1
197197 fi
198198
199199 git push origin "HEAD:${target_branch}"
200200 echo "commit-sha=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
201201
202- - name : Fail when generation errors occurred
202+ - name : Fail if generation errors occurred
203203 if : ${{ inputs.fail-on-generate-error == 'true' }}
204204 shell : bash
205205 run : |
206206 set -euo pipefail
207207 failed="${JAIPILOT_GENERATE_FAILED:-0}"
208208 if [ "$failed" -gt 0 ]; then
209- echo "jaipilot generate failed for $failed classes." >&2
209+ echo "JAIPilot generation failed for $failed classes." >&2
210210 exit 1
211211 fi
0 commit comments