Skip to content

Commit

Permalink
Merge pull request #84 from fkie-cad/add-api-key-usage
Browse files Browse the repository at this point in the history
Use API key when fetching citation information
  • Loading branch information
ru37z authored Sep 30, 2024
2 parents d279038 + 5a2c1e2 commit 87dbe74
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
# Build job
build:
runs-on: ubuntu-latest
environment: github-pages
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -68,7 +69,9 @@ jobs:
run: pip install pandas matplotlib seaborn requests

- name: Fetch citation information from papers
run: python tools/count_citations.py
env:
S2_API_KEY: ${{ secrets.S2_API_KEY }}
run: python tools/count_citations.py --api-key $S2_API_KEY

- name: Generate CSV assets # must happen after fetching citation info
run: python tools/generate_csv.py
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/jekyll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
# Build job
build:
runs-on: ubuntu-latest
environment: github-pages
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -55,7 +56,9 @@ jobs:
run: pip install pandas matplotlib seaborn requests

- name: Fetch citation information from papers
run: python tools/count_citations.py
env:
S2_API_KEY: ${{ secrets.S2_API_KEY }}
run: python tools/count_citations.py --api-key $S2_API_KEY

- name: Generate CSV assets # must happen after fetching citation info
run: python tools/generate_csv.py
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/keep_alive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: API Key Keep Alive

on:
schedule:
- cron: "0 1 * * SUN" # At 01:00 on Sunday

jobs:
keep_alive:
runs-on: ubuntu-latest
environment: github-pages
steps:
- name: Make a single API request to prevent the API key from expiring
env:
S2_API_KEY: ${{ secrets.S2_API_KEY }}
run: |
wget -qO- --header="x-api-key: $S2_API_KEY" --header="Content-Type: application/json" "https://api.semanticscholar.org/graph/v1/paper/431f7fb6c9e12aaaa8dcc2abefa1c6514ab40074"

0 comments on commit 87dbe74

Please sign in to comment.