From 373a917e114e7b392e38933dabc456d778d6a71a Mon Sep 17 00:00:00 2001 From: Prudhvi Godithi Date: Mon, 20 May 2024 11:30:05 -0700 Subject: [PATCH] Gradle Check Optimization Signed-off-by: Prudhvi Godithi --- .github/workflows/sample-check.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sample-check.yml b/.github/workflows/sample-check.yml index 430a68dde3..bd1b535880 100644 --- a/.github/workflows/sample-check.yml +++ b/.github/workflows/sample-check.yml @@ -39,7 +39,20 @@ jobs: echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV echo "pr_owner=$(jq --raw-output .pull_request.user.login $GITHUB_EVENT_PATH)" >> $GITHUB_ENV echo "pr_or_commit_description=$(jq --ascii-output .pull_request.body $GITHUB_EVENT_PATH)" >> $GITHUB_ENV + cat $GITHUB_ENV + - uses: actions/github-script@v7 + if: github.event_name == 'push' + id: get_pr_data + with: + script: | + return ( + await github.rest.repos.listPullRequestsAssociatedWithCommit({ + commit_sha: context.sha, + owner: context.repo.owner, + repo: context.repo.repo, + }) + ).data[0]; - name: Setup environment variables (Push) if: github.event_name == 'push' run: | @@ -53,6 +66,6 @@ jobs: echo "pr_to_clone_url=$repo_url" >> $GITHUB_ENV echo "pr_title=Push trigger $branch_name $ref_id $repo_url" >> $GITHUB_ENV echo "pr_owner=$(jq --raw-output '.commits[0].author.username' $GITHUB_EVENT_PATH)" >> $GITHUB_ENV - echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV + echo 'pr_number=${{ fromJson(steps.get_pr_data.outputs.result).number }}' >> $GITHUB_ENV echo "pr_or_commit_description=$(jq --ascii-output .head_commit.message $GITHUB_EVENT_PATH)" >> $GITHUB_ENV cat $GITHUB_ENV