forked from EddieHubCommunity/BioDrop
-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.28 KB
/
check-profile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: JSON Profile source check
on:
pull_request:
paths:
- "data/**.json"
jobs:
api-response-source:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# Make the API request corresponding to the pull request author and outputs the data of the user as JSON string
- name: Make API request
id: myRequest
uses: fjogeleit/http-request-action@main
with:
url: "https://biodrop.io/api/profiles/${{ github.event.pull_request.user.login }}"
preventFailureOnNoResponse: "true"
ignoreStatusCodes: "404"
method: "GET"
# fail the job if the source is database
- name: If 404 pass the job
if: steps.myRequest.outputs.response == ''
run: |
echo "${{ github.event.pull_request.user.login }}'s Profile does not exist in database"
exit 0
# fail the job if the source is database
- name: Check if source is database
if: steps.myRequest.outputs.response != '' && fromJson(steps.myRequest.outputs.response).source == 'database'
run: |
echo "${{ github.event.pull_request.user.login }}'s Profile is already in database - you are already using forms, please continue to use them"
exit 1