Skip to content

Commit

Permalink
chore: rm github badge creation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
timeowilliams committed Sep 14, 2024
1 parent e62c369 commit af8627a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 224 deletions.
189 changes: 0 additions & 189 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"license": "ISC",
"dependencies": {
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@size-limit/preset-app": "^11.1.5",
"@size-limit/preset-big-lib": "^11.1.5",
"@size-limit/preset-small-lib": "^11.1.5",
Expand Down
33 changes: 0 additions & 33 deletions size-limit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { execSync } from "child_process";
import fs from "fs";
import core from "@actions/core";
import github from "@actions/github";

(async function run() {
try {
Expand Down Expand Up @@ -56,38 +55,6 @@ import github from "@actions/github";
// Step 6: Create the badge URL using shields.io
const badgeUrl = `https://img.shields.io/badge/${encodeURIComponent(label)}-${size}KB-${color}`;
console.log(`Badge URL: ${badgeUrl}`);

// Step 7: Optionally, commit the badge to the repository
const githubToken = core.getInput("github_token");
if (githubToken) {
const octokit = github.getOctokit(githubToken);
const badgeContent = `![Bundle Size](${badgeUrl})`;
const branch = core.getInput("branch") || "main";

try {
await octokit.repos.createOrUpdateFileContents({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
path: "README.md", // or any other file where you want the badge to appear
message: "Update bundle size badge",
content: Buffer.from(badgeContent).toString("base64"),
branch,
committer: {
name: "github-actions",
email: "[email protected]",
},
author: {
name: "github-actions",
email: "[email protected]",
},
});
console.log("Badge added to README.md");
} catch (error) {
core.setFailed(
`Failed to update the README with the badge: ${error.message}`,
);
}
}
} catch (error) {
core.setFailed(error.message);
}
Expand Down
2 changes: 1 addition & 1 deletion size-report.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"passed": true,
"size": 88048,
"sizeLimit": 500000,
"running": 2.9568000000000003,
"running": 2.1483,
"loading": 1.7196875
}
]

0 comments on commit af8627a

Please sign in to comment.