diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 4ee1bb9..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: 2.1 - -defaults: &defaults - working_directory: ~/repo - docker: - - image: circleci/node:10 - -commands: - install: - steps: - - checkout - - restore_cache: - keys: - - dependency-cache-{{ checksum "package.json" }} - - dependency-cache- - - run: npm install - - save_cache: - key: dependency-cache-{{ checksum "package.json" }} - paths: - - node_modules - -jobs: - wakabox: - <<: *defaults - steps: - - install - - run: node index.js - -workflows: - version: 2 - - test: - jobs: - - wakabox - - poll: - triggers: - - schedule: - # Run once every 5 minutes - cron: "0,15,30,45 * * * *" - filters: - branches: - only: - - master - jobs: - - wakabox diff --git a/.github/main.workflow b/.github/main.workflow new file mode 100644 index 0000000..ce761ec --- /dev/null +++ b/.github/main.workflow @@ -0,0 +1,15 @@ +workflow "Update gist with WakaTime stats" { + resolves = ["update-gist"] + on = "schedule(*/10 * * * *)" +} + +action "update-gist" { + uses = "matchai/waka-box@master" + env = { + "GIST_ID" = "968220c97e8da1d047a9a480fa432e54" + } + secrets = [ + "GH_TOKEN", + "WAKATIME_API_KEY", + ] +} diff --git a/README.md b/README.md index ef08cdd..d17fc62 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ --- +> 📌✨ For more pinned-gist projects like this one, check out: https://github.com/matchai/awesome-pinned-gists + ## Setup ### Prep work @@ -18,12 +20,12 @@ ### Project setup 1. Fork this repo -1. Log into CircleCI with your GitHub (https://circleci.com/vcs-authorize/) -1. Click on "Add Projects" on the sidebar -1. Set up a project with the newly created fork -1. Go to Project Settings > Environment Variables +1. Edit the [environment variable](https://github.com/matchai/bird-box/blob/master/.github/main.workflow?short_path=5225be4#L9-L10) in `.github/main.workflow`: + + - **GIST_ID:** The ID portion from your gist url: `https://gist.github.com/matchai/`**`6d5f84419863089a167387da62dd7081`**. + +1. Go to the repo **Settings > Secrets** 1. Add the following environment variables: -- **GIST_ID:** The ID portion from your gist url `https://gist.github.com/matchai/`**`6d5f84419863089a167387da62dd7081`**. -- **GITHUB_TOKEN:** The GitHub token generated above. +- **GH_TOKEN:** The GitHub token generated above. - **WAKATIME_API_KEY:** The API key for your WakaTime account. diff --git a/index.js b/index.js index 4991619..f239089 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const Octokit = require("@octokit/rest"); const { GIST_ID: gistId, - GITHUB_TOKEN: githubToken, + GH_TOKEN: githubToken, WAKATIME_API_KEY: wakatimeApiKey } = process.env; diff --git a/package-lock.json b/package-lock.json index 030d5c7..cf00f46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "bird-box", + "name": "waka-box", "version": "0.0.1", "lockfileVersion": 1, "requires": true, diff --git a/sample.env b/sample.env index 8980d44..3d3b3a1 100644 --- a/sample.env +++ b/sample.env @@ -1,3 +1,3 @@ GIST_ID= -GITHUB_TOKEN= +GH_TOKEN= WAKATIME_API_KEY=