Skip to content

Commit 5919409

Browse files
(cherry picked from commit 5441d55) Signed-off-by: Prudhvi Godithi <[email protected]> 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> (cherry picked from commit 03c13cb) Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
1 parent a22c1fd commit 5919409

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/gradle-check.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ jobs:
3535
echo "pr_to_clone_url=$(jq --raw-output .pull_request.base.repo.clone_url $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
3636
echo "pr_title=$(jq --raw-output .pull_request.title $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
3737
echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
38+
echo "pr_owner=$(jq --raw-output .pull_request.user.login $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
39+
echo "pr_or_commit_description=$(jq --ascii-output .pull_request.body $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
40+
echo "post_merge_action=false" >> $GITHUB_ENV
41+
42+
# to get the PR data that can be used for post merge actions
43+
- uses: actions/github-script@v7
44+
if: github.event_name == 'push'
45+
id: get_pr_data
46+
with:
47+
github-token: ${{secrets.GITHUB_TOKEN}}
48+
script: |
49+
return (
50+
await github.rest.repos.listPullRequestsAssociatedWithCommit({
51+
commit_sha: context.sha,
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
})
55+
).data[0];
3856
3957
- name: Setup environment variables (Push)
4058
if: github.event_name == 'push'
@@ -47,7 +65,10 @@ jobs:
4765
echo "pr_from_clone_url=$repo_url" >> $GITHUB_ENV
4866
echo "pr_to_clone_url=$repo_url" >> $GITHUB_ENV
4967
echo "pr_title=Push trigger $branch_name $ref_id $repo_url" >> $GITHUB_ENV
50-
echo "pr_number=Null" >> $GITHUB_ENV
68+
echo "pr_owner=$(jq --raw-output '.commits[0].author.username' $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
69+
echo 'pr_number=${{ fromJson(steps.get_pr_data.outputs.result).number }}' >> $GITHUB_ENV
70+
echo "pr_or_commit_description=$(jq --ascii-output .head_commit.message $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
71+
echo "post_merge_action=true" >> $GITHUB_ENV
5172
5273
- name: Checkout opensearch-build repo
5374
uses: actions/checkout@v4

0 commit comments

Comments
 (0)