Skip to content

Commit

Permalink
Merge pull request #18 from yoshi389111/release-0.2.0
Browse files Browse the repository at this point in the history
Release 0.2.0
  • Loading branch information
yoshi389111 committed May 11, 2021
2 parents 22192da + 27f1bd9 commit b36be1e
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 15 deletions.
21 changes: 21 additions & 0 deletions CHANGE_LOG.md
@@ -0,0 +1,21 @@
# Change Log

## 2021-05-11, 0.2.0 release

* The repositories to be aggregated are only those owned by the user.
* Allow the number of repositories to be aggregated to be defined by environment variables.
* `MAX_REPOS` : (optional) max repositories, default 100
* Make the colors of the four seasons mode every week and make a gradation.
* The image colors of each season are as follows.
* spring flowers
* summer leaves
* autumn leaves
* winter snow
* Label the radar chart scale with "1-, 10, 100, 1K, 10K+".
* Supports Halloween mode on github.
* The USERNAME can also be specified from the argument.
* Usage: `node dist/index.js <USER-NAME>` without env `USERNAME`

## 2021-05-09, 0.1.0 release

First release.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -65,7 +65,7 @@ This will add the action to the repository.
#### Environment variables

* `GITHUB_TOKEN` : (required) access token
* `USERNAME` : (required) target user name
* `USERNAME` : (required) target user name (or specify with an argument).
* `MAX_REPOS` : (optional) max repositories, default 100 - since ver. 0.2.0

### step 3. Manually launch the action
Expand Down
6 changes: 2 additions & 4 deletions dist/index.js
Expand Up @@ -1078,7 +1078,7 @@ const fetchData = async (token, userName, maxRepos) => {
headers: headers,
});
const result = response.data.data;
if (result) {
if (result && result.user.repositories.nodes.length === maxReposOneQuery) {
const repos1 = result.user.repositories;
let cursor = repos1.edges[repos1.edges.length - 1].cursor;
while (repos1.nodes.length < maxRepos) {
Expand Down Expand Up @@ -1164,9 +1164,7 @@ const main = async () => {
core.setFailed('GITHUB_TOKEN is empty');
return;
}
const userName = 3 <= process.argv.length
? process.argv[2]
: process.env.USERNAME;
const userName = 3 <= process.argv.length ? process.argv[2] : process.env.USERNAME;
if (!userName) {
core.setFailed('USERNAME is empty');
return;
Expand Down
4 changes: 2 additions & 2 deletions docs/README.ja-jp.md
Expand Up @@ -64,8 +64,8 @@ jobs:
#### 環境変数

* `GITHUB_TOKEN` : (必須) アクセストークン
* `USERNAME` : (必須) 対象のユーザー名
* `MAX_REPOS` : (任意) 最大のリポジトリ数。デフォルトは10 - バージョン 0.2.0 で追加
* `USERNAME` : (必須) 対象のユーザー名. (あるいは引数で指定する)
* `MAX_REPOS` : (任意) 最大のリポジトリ数。デフォルトは100 - バージョン 0.2.0 で追加

### 手順 3. アクションを手動起動する

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "github-profile-3d-contrib",
"version": "0.1.0",
"version": "0.2.0",
"description": "Generate profile 3D Contributions",
"main": "dist/index.js",
"scripts": {
Expand Down
53 changes: 52 additions & 1 deletion spec/dummy-data.ts
Expand Up @@ -2,9 +2,10 @@ import * as client from '../src/github-graphql';

export const dummyData: client.ResponseType = {
"data": {
"viewer": {
"user": {
"contributionsCollection": {
"contributionCalendar": {
"isHalloween": false,
"totalContributions": 366,
"weeks": [
{
Expand Down Expand Up @@ -2236,6 +2237,56 @@ export const dummyData: client.ResponseType = {
"totalRepositoryContributions": 6
},
"repositories": {
"edges": [
{
"cursor": "a",
},
{
"cursor": "b",
},
{
"cursor": "c",
},
{
"cursor": "d",
},
{
"cursor": "e",
},
{
"cursor": "f",
},
{
"cursor": "g",
},
{
"cursor": "h",
},
{
"cursor": "i",
},
{
"cursor": "j",
},
{
"cursor": "k",
},
{
"cursor": "l",
},
{
"cursor": "m",
},
{
"cursor": "n",
},
{
"cursor": "o",
},
{
"cursor": "p",
}
],
"nodes": [
{
"forkCount": 0,
Expand Down
3 changes: 1 addition & 2 deletions spec/github-graphql.spec.ts
Expand Up @@ -12,8 +12,7 @@ afterEach(() => {
describe('github-graphql', () => {
it('fetchData', async () => {
mock.onPost(client.URL).reply(200, dummyData);
const res = await client.fetchData("dummy");

const res = await client.fetchData("dummy", "username", 100);
expect(res).toEqual(dummyData);
});
});
2 changes: 1 addition & 1 deletion src/github-graphql.ts
Expand Up @@ -142,7 +142,7 @@ export const fetchData = async (
headers: headers,
});
const result = response.data.data;
if (result) {
if (result && result.user.repositories.nodes.length === maxReposOneQuery) {
const repos1 = result.user.repositories;
let cursor = repos1.edges[repos1.edges.length - 1].cursor;
while (repos1.nodes.length < maxRepos) {
Expand Down
5 changes: 2 additions & 3 deletions src/index.ts
Expand Up @@ -11,9 +11,8 @@ export const main = async (): Promise<void> => {
core.setFailed('GITHUB_TOKEN is empty');
return;
}
const userName = 3 <= process.argv.length
? process.argv[2]
: process.env.USERNAME;
const userName =
3 <= process.argv.length ? process.argv[2] : process.env.USERNAME;
if (!userName) {
core.setFailed('USERNAME is empty');
return;
Expand Down

0 comments on commit b36be1e

Please sign in to comment.