Skip to content

Commit 9d4754d

Browse files
authored
Fix auto license report commit message and PR comment (#14019)
1 parent 97c6bd7 commit 9d4754d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/auto-update-pull-request.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,22 @@ jobs:
5555
git config user.name otelbot
5656
git config user.email [email protected]
5757
58+
- id: gradle-task
59+
if: steps.unzip-patch.outputs.exists == 'true'
60+
run: |
61+
if [[ "${{ github.event.workflow_run.name }}" == "Auto spotless" ]]; then
62+
echo "name=spotlessApply" >> $GITHUB_OUTPUT
63+
elif [[ "${{ github.event.workflow_run.name }}" == "Auto license report" ]]; then
64+
echo "name=generateLicenseReport" >> $GITHUB_OUTPUT
65+
else
66+
echo "name=unknown" >> $GITHUB_OUTPUT
67+
fi
68+
5869
- name: Apply patch and push
5970
if: steps.unzip-patch.outputs.exists == 'true'
6071
run: |
6172
git apply "${{ runner.temp }}/patch"
62-
git commit -a -m "./gradlew spotlessApply"
73+
git commit -a -m "./gradlew ${{ steps.gradle-task.outputs.name }}"
6374
git push
6475
6576
- id: get-pr
@@ -84,12 +95,12 @@ jobs:
8495
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
8596
PR_NUMBER: ${{ steps.get-pr.outputs.number }}
8697
run: |
87-
gh pr comment $PR_NUMBER --body "🔧 The result from spotlessApply was committed to the PR branch."
98+
gh pr comment $PR_NUMBER --body "🔧 The result from ${{ steps.gradle-task.outputs.name }} was committed to the PR branch."
8899
89100
- if: steps.unzip-patch.outputs.exists == 'true' && failure()
90101
env:
91102
GH_REPO: ${{ github.repository }}
92103
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
93104
PR_NUMBER: ${{ steps.get-pr.outputs.number }}
94105
run: |
95-
gh pr comment $PR_NUMBER --body "❌ The result from spotlessApply could not be committed to the PR branch, see logs: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID."
106+
gh pr comment $PR_NUMBER --body "❌ The result from ${{ steps.gradle-task.outputs.name }} could not be committed to the PR branch, see logs: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID."

0 commit comments

Comments
 (0)