Skip to content

Commit

Permalink
✨ use default github token ( thanks @Awayume ! )
Browse files Browse the repository at this point in the history
  • Loading branch information
Platane committed Oct 17, 2023
1 parent 01fa6d7 commit 0baf35b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 14 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ jobs:
dist/github-contribution-grid-snake.svg
dist/github-contribution-grid-snake-dark.svg?palette=github-dark
dist/github-contribution-grid-snake.gif?color_snake=orange&color_dots=#bfd6f6,#8dbdff,#64a1f4,#4b91f1,#3c7dd9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: ensure the generated file exists
run: |
Expand Down Expand Up @@ -79,8 +77,6 @@ jobs:
outputs: |
dist/github-contribution-grid-snake.svg
dist/github-contribution-grid-snake-dark.svg?palette=github-dark
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: ensure the generated file exists
run: |
Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ Available as github action. It can automatically generate a new image each day.
dist/github-snake.svg
dist/github-snake-dark.svg?palette=github-dark
dist/ocean.gif?color_snake=orange&color_dots=#bfd6f6,#8dbdff,#64a1f4,#4b91f1,#3c7dd9
env:
# a github token is required to fetch the contribution calendar from github API
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

[example with cron job](https://github.com/Platane/Platane/blob/master/.github/workflows/main.yml#L26-L35)
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
github_user_name:
description: "github user name"
required: true
github_token:
description: "github token used to fetch the contribution calendar. Default to the action token if empty."
required: false
default: ${{ github.token }}
outputs:
required: false
default: null
Expand Down
3 changes: 2 additions & 1 deletion packages/action/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { parseOutputsOption } from "./outputsOptions";
core.getInput("svg_out_path"),
]
);
const githubToken = process.env.GITHUB_TOKEN!;
const githubToken =
process.env.GITHUB_TOKEN ?? core.getInput("github_token");

const { generateContributionSnake } = await import(
"./generateContributionSnake"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ describe("getGithubUserContribution", () => {
});

it("should resolve", async () => {
console.log(
"process.env.GITHUB_TOKEN",
process.env.GITHUB_TOKEN?.replace(/\d/g, "x")
);

await promise;
});

Expand Down
4 changes: 4 additions & 0 deletions svg-only/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ inputs:
github_user_name:
description: "github user name"
required: true
github_token:
description: "github token used to fetch the contribution calendar. Default to the action token if empty."
required: false
default: ${{ github.token }}
outputs:
required: false
default: null
Expand Down

0 comments on commit 0baf35b

Please sign in to comment.