Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch 2 #33

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: build

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node_version: [14]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- name: build
run: |
yarn install
yarn build
- name: commit change & push
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add .
git commit --allow-empty -m ":robot: build automatically"
git push
- name: repository dispatch
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GH_TOKEN }}
event-type: build-event
7 changes: 3 additions & 4 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Update gist
on:
push:
branches:
- master
repository_dispatch:
types: [build-event]
schedule:
- cron: "0 0 * * *"
jobs:
Expand All @@ -15,4 +14,4 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GIST_ID: 9842e074b8ee46aef76fd0d493bae0ed
TIMEZONE: Asia/Taipei
TIMEZONE: Asia/Korea
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface IRepo {
let night = 0; // 0 - 6

committedTimeResponseMap.forEach(committedTimeResponse => {
committedTimeResponse?.data?.repository?.ref?.target?.history?.edges.forEach(edge => {
committedTimeResponse?.data?.repository?.defaultBranchRef?.target?.history?.edges.forEach(edge => {
const committedDate = edge?.node?.committedDate;
const timeString = new Date(committedDate).toLocaleTimeString('en-US', { hour12: false, timeZone: process.env.TIMEZONE });
const hour = +(timeString.split(':')[0]);
Expand Down
2 changes: 1 addition & 1 deletion src/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const createContributedRepoQuery = (username: string) => `
export const createCommittedDateQuery = (id: string, name: string, owner: string) => `
query {
repository(owner: "${owner}", name: "${name}") {
ref(qualifiedName: "master") {
defaultBranchRef {
target {
... on Commit {
history(first: 100, author: { id: "${id}" }) {
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1189,9 +1189,9 @@ locate-path@^5.0.0:
p-locate "^4.1.0"

lodash@^4.17.14, lodash@^4.17.15:
version "4.17.15"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548"
integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==

log-symbols@^1.0.2:
version "1.0.2"
Expand Down Expand Up @@ -1301,9 +1301,9 @@ nice-try@^1.0.4:
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==

node-fetch@^2.3.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==

normalize-path@^3.0.0:
version "3.0.0"
Expand Down