Skip to content

Commit af4a441

Browse files
authored
Create main.yml
1 parent 25d128a commit af4a441

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Refresh Feed
2+
on:
3+
schedule:
4+
- cron: 10 15 * * 0-6
5+
permissions:
6+
contents: write
7+
jobs:
8+
refresh-feed:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout 🛎️
12+
uses: actions/checkout@v2
13+
with:
14+
persist-credentials: false
15+
16+
# - name: Fetch API Data 📦
17+
# uses: JamesIves/fetch-api-data-action@v2
18+
# with:
19+
# endpoint: https://example.com
20+
# configuration: '{ "method": "GET", "headers": {"Authorization": "Bearer ${{ secrets.API_TOKEN }}"} }'
21+
22+
- name: Fetch API Data 📦
23+
uses: JamesIves/fetch-api-data-action@v2
24+
with:
25+
# The token endpoint is requested first. This retrieves the access token for the other endpoint.
26+
token-endpoint: https://uscms-openproject.k8s.accre.vanderbilt.edu/oauth/token
27+
# The configuration contains secrets held in the Settings/Secrets menu of the repository.
28+
token-configuration: '{ "method": "POST", "body": {"client_id": "${{ secrets.client_id }}", "client_secret": "${{ secrets.client_secret }}"} }'
29+
# Once the token endpoint has fetched then this endpoint is requested.
30+
# endpoint: https://example.com/data
31+
endpoint: 'http://uscms-openproject.k8s.accre.vanderbilt.edu/api/v3/work_packages?filters=[{"project": {"operator": "=", "values": ["4","5","35","6","8"]}}]&pageSize=1000'
32+
# The bearer token here is returned from the TOKEN_ENDPOINT call. The returned data looks like so: {data: {access_token: '123'}}, meaning it can be accessed using the triple bracket syntax.
33+
configuration: '{ "method": "GET", "headers": {"Authorization": "Bearer {{{ data.access_token }}}"} }'
34+
35+
- name: Build and Deploy 🚀
36+
uses: JamesIves/github-pages-deploy-action@v4
37+
with:
38+
branch: main # Pushes the updates to the main branch.
39+
folder: fetch-api-data-action # The location of the data.json file saved by the Fetch API Data action.
40+
target-folder: data # Saves the data into the 'data' directory on the main branch.

0 commit comments

Comments
 (0)