Replace Circle CI with GitHub Actions

This commit is contained in:
Matan Kushner
2019-04-06 18:16:42 -04:00
parent 2df7d3078e
commit f289bca357
6 changed files with 26 additions and 55 deletions

View File

@@ -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

15
.github/main.workflow vendored Normal file
View File

@@ -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",
]
}

View File

@@ -6,6 +6,8 @@
--- ---
> 📌✨ For more pinned-gist projects like this one, check out: https://github.com/matchai/awesome-pinned-gists
## Setup ## Setup
### Prep work ### Prep work
@@ -18,12 +20,12 @@
### Project setup ### Project setup
1. Fork this repo 1. Fork this repo
1. Log into CircleCI with your GitHub (https://circleci.com/vcs-authorize/) 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`:
1. Click on "Add Projects" on the sidebar
1. Set up a project with the newly created fork - **GIST_ID:** The ID portion from your gist url: `https://gist.github.com/matchai/`**`6d5f84419863089a167387da62dd7081`**.
1. Go to Project Settings > Environment Variables
1. Go to the repo **Settings > Secrets**
1. Add the following environment variables: 1. Add the following environment variables:
- **GIST_ID:** The ID portion from your gist url `https://gist.github.com/matchai/`**`6d5f84419863089a167387da62dd7081`**. - **GH_TOKEN:** The GitHub token generated above.
- **GITHUB_TOKEN:** The GitHub token generated above.
- **WAKATIME_API_KEY:** The API key for your WakaTime account. - **WAKATIME_API_KEY:** The API key for your WakaTime account.

View File

@@ -4,7 +4,7 @@ const Octokit = require("@octokit/rest");
const { const {
GIST_ID: gistId, GIST_ID: gistId,
GITHUB_TOKEN: githubToken, GH_TOKEN: githubToken,
WAKATIME_API_KEY: wakatimeApiKey WAKATIME_API_KEY: wakatimeApiKey
} = process.env; } = process.env;

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{ {
"name": "bird-box", "name": "waka-box",
"version": "0.0.1", "version": "0.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,

View File

@@ -1,3 +1,3 @@
GIST_ID= GIST_ID=
GITHUB_TOKEN= GH_TOKEN=
WAKATIME_API_KEY= WAKATIME_API_KEY=