Compare commits

...

5 Commits
v1.1 ... v1.1.4

Author SHA1 Message Date
platane
1526ced25e 📦 1.1.4 2023-01-09 09:08:11 +01:00
platane
f66842bcf8 🚑 fix github parser 2023-01-09 08:57:23 +01:00
platane
dcdf20756a 🐛 disabled unreliable test 2023-01-09 08:57:23 +01:00
platane
6b34e9a272 🚑 fix github parser 2023-01-09 08:57:23 +01:00
platane
579bcf1afe 📓 2022-04-09 01:25:34 +02:00
5 changed files with 11 additions and 7 deletions

View File

@@ -21,7 +21,7 @@ Available as github action. Automatically generate a new image at the end of the
**github action**
```yaml
- uses: Platane/snk@v1.1.0
- uses: Platane/snk@v1
with:
# github user name to read the contribution graph from (**required**)
# using action context var `github.repository_owner` or specified user
@@ -38,7 +38,7 @@ Available as github action. Automatically generate a new image at the end of the
[example with cron job](https://github.com/Platane/Platane/blob/master/.github/workflows/main.yml#L24-L29)
If you are only interested in generating a svg, you can use this other faster action: `uses: Platane/snk/svg-only@v1.1.0`
If you are only interested in generating a svg, you can use this other faster action: `uses: Platane/snk/svg-only@v1`
**interactive demo**

View File

@@ -4,7 +4,7 @@ author: "platane"
runs:
using: docker
image: docker://platane/snk@sha256:74d02183a9a4adb8e00d9f50e6eb5035a5b6ef02644d848363ef3301235ebd1d
image: docker://platane/snk@1.1.4
inputs:
github_user_name:

View File

@@ -1,7 +1,7 @@
{
"name": "snk",
"description": "Generates a snake game from a github user contributions grid",
"version": "1.1.3",
"version": "1.1.4",
"private": true,
"repository": "github:platane/snk",
"devDependencies": {

View File

@@ -47,7 +47,7 @@ describe("getGithubUserContribution", () => {
});
});
it("should match snapshot for year=2019", async () => {
xit("should match snapshot for year=2019", async () => {
expect(
await getGithubUserContribution("platane", { year: 2019 })
).toMatchSnapshot();

View File

@@ -56,13 +56,17 @@ const parseUserPage = (content: string) => {
//
// parse cells
const rawCells = $(".js-calendar-graph rect[data-count]")
const rawCells = $(".js-calendar-graph rect[data-level][data-date]")
.toArray()
.map((x) => {
const level = +x.attribs["data-level"];
const count = +x.attribs["data-count"];
const date = x.attribs["data-date"];
const literalCount = $(x)
.text()
.match(/(No|\d+) contributions? on/)![1];
const count = literalCount === "No" ? 0 : +literalCount;
const color = colorScheme[level];
if (!color) throw new Error("could not determine the color of the cell");