Skip to content

Commit 4926f1a

Browse files
committed
refactor: get pr number test (#172)
1 parent 41cb62f commit 4926f1a

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

.github/workflows/chromatic.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ jobs:
66
chromatic-deployment:
77
name: Chromatic
88
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
pull-requests: read
912
steps:
1013
- name: Checkout
1114
uses: actions/checkout@v1
@@ -21,11 +24,29 @@ jobs:
2124
autoAcceptChanges: true
2225
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
2326

24-
- name: Comment PR
25-
uses: thollander/actions-comment-pull-request@v3
27+
- name: Get PR data
28+
uses: actions/github-script@v7
29+
id: get_pr_data
2630
with:
27-
message: |
28-
Hello world ! :wave:
31+
script: |
32+
return (
33+
await github.rest.repos.listPullRequestsAssociatedWithCommit({
34+
commit_sha: context.sha,
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
})
38+
).data[0];
39+
40+
- name: Pull Request data
41+
run: |
42+
echo '${{ fromJson(steps.get_pr_data.outputs.result).number }}'
43+
echo '${{ fromJson(steps.get_pr_data.outputs.result).title }}'
44+
45+
# - name: Comment PR
46+
# uses: thollander/actions-comment-pull-request@v3
47+
# with:
48+
# message: |
49+
# Hello world ! :wave:
2950

3051
# - name: comment PR
3152
# uses: thollander/actions-comment-pull-request@v1

0 commit comments

Comments
 (0)