Skip to content

Commit b85bdc7

Browse files
ci: updated prmerged.yaml
1 parent 8581918 commit b85bdc7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/prmerged.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: On Pull Request Merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
9+
on-merge:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.event.pull_request.merged == true }}
12+
steps:
13+
- name: Get Pull Request Data
14+
id: get-pr-data
15+
env:
16+
PULL_REQUEST_OWNER: ${{ github.event.pull_request.user.login }}
17+
PULL_REQUEST_LABELS: ${{ join(github.event.pull_request.labels.*.name, ', ') }}
18+
REPOSITORY_NAME: ${{ github.event.repository.name }}
19+
REPOSITORY_URL: ${{ github.event.repository.html_url }}
20+
run: |
21+
echo "::set-output name=owner::$PULL_REQUEST_OWNER"
22+
echo "::set-output name=labels::$PULL_REQUEST_LABELS"
23+
echo "::set-output name=repo_name::$REPOSITORY_NAME"
24+
echo "::set-output name=repo_url::$REPOSITORY_URL"
25+
26+
- name: Send Data to API
27+
env:
28+
API_URL: https://osf-api.onrender.com/api/prmerged
29+
API_AUTH_TOKEN: ${{ secrets.API_AUTH_TOKEN }}
30+
run: |
31+
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 }}"}')
32+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $API_AUTH_TOKEN" -d "$payload" "$API_URL"

0 commit comments

Comments
 (0)