Skip to content

Commit d31bd1c

Browse files
committed
github actions: Convert github-script usage to gh
This keeps all of our PR interaction consistent
1 parent 2341a8e commit d31bd1c

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

.github/workflows/validate-kernel-commits.yml

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -198,34 +198,25 @@ jobs:
198198
199199
- name: Comment PR with JIRA issues
200200
if: steps.jira_check.outputs.has_issues == 'true'
201-
uses: actions/github-script@v7
202-
with:
203-
github-token: ${{ secrets.GITHUB_TOKEN }}
204-
script: |
205-
const output = process.env.CHECK_OUTPUT;
206-
207-
github.rest.issues.createComment({
208-
issue_number: context.issue.number,
209-
owner: context.repo.owner,
210-
repo: context.repo.repo,
211-
body: output
212-
});
213201
env:
214-
CHECK_OUTPUT: ${{ steps.jira_check.outputs.output }}
202+
GH_TOKEN: ${{ github.token }}
203+
run: |
204+
if ! gh pr comment ${{ github.event.pull_request.number }} \
205+
--body "${{ steps.jira_check.outputs.output }}" \
206+
--repo ${{ github.repository }}; then
207+
echo "❌ Failed to post JIRA check comment to PR"
208+
exit 1
209+
fi
215210
216211
- name: Request changes if LTS mismatch
217212
if: steps.jira_check.outputs.has_lts_mismatch == 'true'
218-
uses: actions/github-script@v7
219-
with:
220-
github-token: ${{ secrets.GITHUB_TOKEN }}
221-
script: |
222-
github.rest.pulls.createReview({
223-
owner: context.repo.owner,
224-
repo: context.repo.repo,
225-
pull_number: context.issue.number,
226-
event: 'REQUEST_CHANGES',
227-
body: '⚠️ This PR contains VULN tickets that do not match the target LTS product. Please review the JIRA ticket assignments and ensure they match the merge target branch.'
228-
});
213+
env:
214+
GH_TOKEN: ${{ github.token }}
215+
run: |
216+
gh pr review ${{ github.event.pull_request.number }} \
217+
--request-changes \
218+
--body "⚠️ This PR contains VULN tickets that do not match the target LTS product. Please review the JIRA ticket assignments and ensure they match the merge target branch." \
219+
--repo ${{ github.repository }}
229220
230221
- name: Fail workflow if JIRA errors found
231222
if: steps.jira_check.outcome == 'failure'

0 commit comments

Comments
 (0)