Skip to content

Commit 381e580

Browse files
authored
Create display_pr.yml
1 parent 733a69a commit 381e580

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/display_pr.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Display PR Details
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
display-pr-details:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Fetch PR details
16+
id: pr-details
17+
run: |
18+
PR_NUMBER=${{ github.event.pull_request.number }}
19+
PR_TITLE=${{ github.event.pull_request.title }}
20+
PR_BODY=${{ github.event.pull_request.body }}
21+
PR_USER=${{ github.event.pull_request.user.login }}
22+
echo "PR_NUMBER=${PR_NUMBER}" >> $GITHUB_ENV
23+
echo "PR_TITLE=${PR_TITLE}" >> $GITHUB_ENV
24+
echo "PR_BODY=${PR_BODY}" >> $GITHUB_ENV
25+
echo "PR_USER=${PR_USER}" >> $GITHUB_ENV
26+
27+
- name: Fetch PR labels
28+
id: pr-labels
29+
run: |
30+
PR_NUMBER=${{ env.PR_NUMBER }}
31+
LABELS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
32+
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}" \
33+
| jq '.labels | map(.name) | join(", ")')
34+
echo "LABELS=${LABELS}" >> $GITHUB_ENV
35+
36+
- name: Display PR details
37+
run: |
38+
echo "Pull Request Number: ${{ env.PR_NUMBER }}"
39+
echo "Pull Request Title: ${{ env.PR_TITLE }}"
40+
echo "Pull Request Body: ${{ env.PR_BODY }}"
41+
echo "Pull Request User: ${{ env.PR_USER }}"
42+
echo "Pull Request Labels: ${{ env.LABELS }}"

0 commit comments

Comments
 (0)