Skip to content

Commit 05a1221

Browse files
committed
github actions: Convert github-script usage to gh
This keeps all of our PR interaction consistent
1 parent 904e2f5 commit 05a1221

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
@@ -190,34 +190,25 @@ jobs:
190190
191191
- name: Comment PR with JIRA issues
192192
if: steps.jira_check.outputs.has_issues == 'true'
193-
uses: actions/github-script@v7
194-
with:
195-
github-token: ${{ secrets.GITHUB_TOKEN }}
196-
script: |
197-
const output = process.env.CHECK_OUTPUT;
198-
199-
github.rest.issues.createComment({
200-
issue_number: context.issue.number,
201-
owner: context.repo.owner,
202-
repo: context.repo.repo,
203-
body: output
204-
});
205193
env:
206-
CHECK_OUTPUT: ${{ steps.jira_check.outputs.output }}
194+
GH_TOKEN: ${{ github.token }}
195+
run: |
196+
if ! gh pr comment ${{ github.event.pull_request.number }} \
197+
--body "${{ steps.jira_check.outputs.output }}" \
198+
--repo ${{ github.repository }}; then
199+
echo "❌ Failed to post JIRA check comment to PR"
200+
exit 1
201+
fi
207202
208203
- name: Request changes if LTS mismatch
209204
if: steps.jira_check.outputs.has_lts_mismatch == 'true'
210-
uses: actions/github-script@v7
211-
with:
212-
github-token: ${{ secrets.GITHUB_TOKEN }}
213-
script: |
214-
github.rest.pulls.createReview({
215-
owner: context.repo.owner,
216-
repo: context.repo.repo,
217-
pull_number: context.issue.number,
218-
event: 'REQUEST_CHANGES',
219-
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.'
220-
});
205+
env:
206+
GH_TOKEN: ${{ github.token }}
207+
run: |
208+
gh pr review ${{ github.event.pull_request.number }} \
209+
--request-changes \
210+
--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." \
211+
--repo ${{ github.repository }}
221212
222213
- name: Fail workflow if JIRA errors found
223214
if: steps.jira_check.outcome == 'failure'

0 commit comments

Comments
 (0)