Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 2.33 KB

README.md

File metadata and controls

63 lines (45 loc) · 2.33 KB

Stargazer app

This Spin application pulls the stargazer count of a repo of your choosing for the current day. It then stores the {date: stargazer_count} pair in a Spin key-value store.

You can see an example running at https://stargazer-counter.fermyon.app/static/index.html

Spin features used

Prerequisites

Let's get started

  1. Clone the repo, and modify spin.toml

After cloning this repo, take a look at spin.toml and update the following values with your credentials and preferred target

[component.config]
# this is your GH PAT
gh_auth_token = "{{ gh_auth_token }}"
# this is the owner of the repo you want to pull stargazer count from
owner = "fermyon"
# this is the repo youi want to pull stargazer count from
repo = "spin"
  1. Run application locally to ensure everything works as expected

Build and deploy Spin app locally:

SPIN_CONFIG_GH_AUTH_TOKEN="{SECRET}" spin build --up    

Check to see stargazer count:

curl localhost:3000

Optionally, this can be viewed on KV explorer as well at the following URL: http://localhost:3000/internal/kv-explorer.

  1. Deploy to Fermyon Cloud
spin cloud deploy --variable gh_auth_token="{YOUR_PAT}"
  1. Apply custom fermyon subdomain (optional) Choose a friendly name of your choice following this tutorial.

  2. Set up cron job at a daily reoccurance, pointing at our custom Fermyon subdomain (or default domain name if you skipped step 4): img of cron dash

Complete :)