File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 39
39
echo "pr_number=$(jq --raw-output .pull_request.number $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
40
40
echo "pr_owner=$(jq --raw-output .pull_request.user.login $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
41
41
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];
42
58
43
59
- name : Setup environment variables (Push)
44
60
if : github.event_name == 'push'
53
69
echo "pr_to_clone_url=$repo_url" >> $GITHUB_ENV
54
70
echo "pr_title=Push trigger $branch_name $ref_id $repo_url" >> $GITHUB_ENV
55
71
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
57
73
echo "pr_or_commit_description=$(jq --ascii-output .head_commit.message $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
74
+ echo "post_merge_action=true" >> $GITHUB_ENV
58
75
59
76
- name : Checkout opensearch-build repo
60
77
uses : actions/checkout@v4
You can’t perform that action at this time.
0 commit comments