Skip to content

Commit 03c13cb

Browse files
Gradle Check Optimization (#13786) (#13787)
(cherry picked from commit 5441d55) Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 9f25c38 commit 03c13cb

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/gradle-check.yml

+18-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ jobs:
3939
echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
4040
echo "pr_owner=$(jq --raw-output .pull_request.user.login $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
4141
echo "pr_or_commit_description=$(jq --ascii-output .pull_request.body $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
42+
echo "post_merge_action=false" >> $GITHUB_ENV
43+
44+
# to get the PR data that can be used for post merge actions
45+
- uses: actions/github-script@v7
46+
if: github.event_name == 'push'
47+
id: get_pr_data
48+
with:
49+
github-token: ${{secrets.GITHUB_TOKEN}}
50+
script: |
51+
return (
52+
await github.rest.repos.listPullRequestsAssociatedWithCommit({
53+
commit_sha: context.sha,
54+
owner: context.repo.owner,
55+
repo: context.repo.repo,
56+
})
57+
).data[0];
4258
4359
- name: Setup environment variables (Push)
4460
if: github.event_name == 'push'
@@ -53,8 +69,9 @@ jobs:
5369
echo "pr_to_clone_url=$repo_url" >> $GITHUB_ENV
5470
echo "pr_title=Push trigger $branch_name $ref_id $repo_url" >> $GITHUB_ENV
5571
echo "pr_owner=$(jq --raw-output '.commits[0].author.username' $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
56-
echo "pr_number=Null" >> $GITHUB_ENV
72+
echo 'pr_number=${{ fromJson(steps.get_pr_data.outputs.result).number }}' >> $GITHUB_ENV
5773
echo "pr_or_commit_description=$(jq --ascii-output .head_commit.message $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
74+
echo "post_merge_action=true" >> $GITHUB_ENV
5875
5976
- name: Checkout opensearch-build repo
6077
uses: actions/checkout@v4

0 commit comments

Comments
 (0)