Skip to content

Commit 3d59971

Browse files
chore: updated prmerged.yaml
1 parent 94d2a2b commit 3d59971

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

.github/workflows/prmerged.yaml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,35 @@ jobs:
88
on-merge:
99
runs-on: ubuntu-latest
1010
if: ${{ github.event.pull_request.merged == true }}
11+
permissions:
12+
contents: read
1113
steps:
1214
- name: Get Pull Request Data
1315
id: get-pr-data
14-
env:
15-
PULL_REQUEST_OWNER: ${{ github.event.pull_request.user.login }}
16-
PULL_REQUEST_LABELS: ${{ join(github.event.pull_request.labels.*.name, ', ') }}
17-
REPOSITORY_NAME: ${{ github.event.repository.name }}
18-
REPOSITORY_URL: ${{ github.event.repository.html_url }}
1916
run: |
20-
echo "::set-output name=owner::$PULL_REQUEST_OWNER"
21-
echo "::set-output name=labels::$PULL_REQUEST_LABELS"
22-
echo "::set-output name=repo_name::$REPOSITORY_NAME"
23-
echo "::set-output name=repo_url::$REPOSITORY_URL"
17+
echo "owner=${{ github.event.pull_request.user.login }}" >> $GITHUB_OUTPUT
18+
echo "labels=${{ join(github.event.pull_request.labels.*.name, ', ') }}" >> $GITHUB_OUTPUT
19+
echo "repo_name=${{ github.event.repository.name }}" >> $GITHUB_OUTPUT
20+
echo "repo_url=${{ github.event.repository.html_url }}" >> $GITHUB_OUTPUT
2421
2522
- name: Send Data to API
2623
env:
2724
API_URL: https://opcode.gymkhana.iiitbh.ac.in/api/prmerged
2825
API_AUTH_TOKEN: ${{ secrets.API_AUTH_TOKEN }}
26+
OWNER: ${{ steps.get-pr-data.outputs.owner }}
27+
LABELS: ${{ steps.get-pr-data.outputs.labels }}
28+
REPO_NAME: ${{ steps.get-pr-data.outputs.repo_name }}
29+
REPO_URL: ${{ steps.get-pr-data.outputs.repo_url }}
2930
run: |
30-
payload=$(echo '{"owner":"${{ steps.get-pr-data.outputs.owner }}","labels":"${{ steps.get-pr-data.outputs.labels }}","repository_name":"${{ steps.get-pr-data.outputs.repo_name }}","repository_url":"${{ steps.get-pr-data.outputs.repo_url }}"}')
31-
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_AUTH_TOKEN" -d "$payload" "$API_URL"
31+
payload=$(jq -n \
32+
--arg owner "$OWNER" \
33+
--arg labels "$LABELS" \
34+
--arg repo_name "$REPO_NAME" \
35+
--arg repo_url "$REPO_URL" \
36+
'{owner: $owner, labels: $labels, repository_name: $repo_name, repository_url: $repo_url}')
37+
38+
curl -X POST \
39+
-H "Content-Type: application/json" \
40+
-H "Authorization: Bearer $API_AUTH_TOKEN" \
41+
-d "$payload" \
42+
"$API_URL"

0 commit comments

Comments
 (0)