-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: rm github badge creation logic
- Loading branch information
1 parent
e62c369
commit af8627a
Showing
4 changed files
with
1 addition
and
224 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
|
@@ -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); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters