Last week, I build a simple GitHub Action, called productive-box. It's my first time creating a GitHub Action so I would like to share some insight about it.
The kernel concept about this project is using commit histories to find your most productive hours and declare which type of people you are (simply an early ๐ค or a night ๐ฆ), finally write into your Gist.
Commit history
When it comes to 'commit', we always think of GitHub. That's right. Here I using GitHub API to access commit history. It's also my first time using it. In the beginning, I check out the v3 RESTful API, but I found something newโ-โv4 GraphQL API, so I gave it a try.
The greatest part of GitHub GraphQL API is it provides a real-time and interactive playground:โGraphQL Explorer which makes a better experience with this new stuff.
After I completed this project, I knew that GraphQL just means POST a query and gets something you REALLY need.
Gist
reference to an amazing projectโ-โmatchai/waka-box
Like him, I also use @octokit/rest, the GitHub REST API client for JavaScript.
WorkFlows
Workflows are custom automated processes that you can set up in your repository to build, test, package, release, or deploy any project on GitHub.
Simply saying, it uses GitHub's virtual machine to execute our script and we just only need to write YAML config intoย .github/workflows/xxx.yml.
My Action simply listens to two events: push and schedule. It means that when we push some commits to the master branch(by default) or periodically(just a Linux cron job), it will trigger my built script.
Going Forward
I also have some other ideas about this project. Welcome to follow up or star โญ ๏ธmy project if you're interested in it.
maxam2017 / productive-box
Are you an early ๐ค or a night ๐ฆ? Let's check out in gist
Caution
If you upgrade to v1.1.5+, please remember to:
- move the GIST ID to the Secret
- move the TIMEZONE to the Repository variable For details, refer to the third point in Project Setup.
p.s. when you see this notice in the README of your forked repository, it means you have upgraded to v1.1.5
๐โจproductive-box
Are you an early ๐ค or a night ๐ฆ
When are you most productive during the day?
Let's check out in gist!
This project is inspired by an awesome pinned-gist project.
Find more in https://github.com/matchai/awesome-pinned-gists
Overview
This project uses GitHub graphQL API to get the commit histories and write into the gist by rest.js
Setup
Prep work
- Create a new public GitHub Gist (https://gist.github.com/)
- Create a token with the
gist
andrepo
scope and copy it. (https://github.com/settings/tokens/new)enable
repo
scope seems DANGEROUS
but this GitHub Action only accesses your commit timestampโฆ
Feedback welcome! Thanks for reading.
Top comments (1)
Such a creative way to using GitHub actions!