@@ -34392,7 +34392,6 @@ const previewUpdater = async () => {
3439234392 repository: {
3439334393 owner: github_1.context.repo.owner,
3439434394 repo: github_1.context.repo.repo,
34395- octokit: (0, github_1.getOctokit)(token),
3439634395 },
3439734396 }, configPath);
3439834397 // Read names
@@ -34404,7 +34403,7 @@ const previewUpdater = async () => {
3440434403 // Show working directory
3440534404 (0, core_1.info)(`Working directory: ${config.directory}`);
3440634405 // Authenticate
34407- const repo = new repository_1.Repository(config);
34406+ const repo = new repository_1.Repository(config, (0, github_1.getOctokit)(token) );
3440834407 await repo.authenticate();
3440934408 // Read file
3441034409 const content = (0, filesystem_1.readFile)(config, config.path.readme);
@@ -34463,8 +34462,8 @@ exports.defaultConfig = {
3446334462 fontSize: "100px",
3446434463 icon: "code",
3446534464 packageManager: "auto",
34466- packageName: undefined,
3446734465 packageGlobal: false,
34466+ packageName: undefined,
3446834467 title: undefined,
3446934468 description: undefined,
3447034469 },
@@ -34754,7 +34753,8 @@ const setPreview = (content, config) => {
3475434753 content = `# ${title}\n\n${content}`;
3475534754 }
3475634755 const images = (0, image_1.getImages)(config);
34757- return cleanUp(content).replace(/^(#\s+.+[\n\s]+)/, "$1" + images + "\n\n");
34756+ const replace = "$1";
34757+ return cleanUp(content).replace(/^(#\s+.+[\n\s]+)/, `${replace}${images}\n\n`);
3475834758};
3475934759exports.setPreview = setPreview;
3476034760
@@ -34791,10 +34791,11 @@ exports.Repository = void 0;
3479134791const filesystem_1 = __nccwpck_require__(9742);
3479234792const randomizer_1 = __nccwpck_require__(3678);
3479334793class Repository {
34794- constructor(config) {
34795- this._currentBranch = '' ;
34794+ constructor(config, octokit ) {
34795+ this._currentBranch = "" ;
3479634796 this._newBranch = false;
3479734797 this._config = config;
34798+ this._octokit = octokit;
3479834799 }
3479934800 async authenticate() {
3480034801 try {
@@ -34829,17 +34830,17 @@ class Repository {
3482934830 async checkoutBranch(isNew) {
3483034831 try {
3483134832 this._newBranch = isNew;
34832- await (0, filesystem_1.exec)(`git switch ${isNew ? '-c' : '' } "${this.branchName()}"`);
34833+ await (0, filesystem_1.exec)(`git switch ${isNew ? "-c" : "" } "${this.branchName()}"`);
3483334834 }
3483434835 catch (error) {
3483534836 // @ts-expect-error
34836- error.message = `Error checking out ${isNew ? ' new' : ' existing' } branch "${this.branchName()}": ${error.message}`;
34837+ error.message = `Error checking out ${isNew ? " new" : " existing" } branch "${this.branchName()}": ${error.message}`;
3483734838 throw error;
3483834839 }
3483934840 }
3484034841 async stage() {
3484134842 try {
34842- await (0, filesystem_1.exec)(' git add ' + this._config.path.readme);
34843+ await (0, filesystem_1.exec)(` git add ${ this._config.path.readme}` );
3484334844 }
3484434845 catch (error) {
3484534846 // @ts-expect-error
@@ -34850,7 +34851,7 @@ class Repository {
3485034851 async commit() {
3485134852 try {
3485234853 const message = this._config.repository.commit.title +
34853- '\n' +
34854+ "\n" +
3485434855 this._config.repository.commit.body;
3485534856 await (0, filesystem_1.exec)(`git commit -m "${message}"`);
3485634857 }
@@ -34862,7 +34863,7 @@ class Repository {
3486234863 }
3486334864 async push() {
3486434865 try {
34865- let cmd = ' git push' ;
34866+ let cmd = " git push" ;
3486634867 if (this._newBranch) {
3486734868 cmd += ` --set-upstream origin ${this.branchName()}`;
3486834869 }
@@ -34877,13 +34878,13 @@ class Repository {
3487734878 async createPullRequest() {
3487834879 try {
3487934880 const defaultBranch = await (0, filesystem_1.exec)(`git remote show origin | grep 'HEAD branch' | cut -d ' ' -f5`);
34880- return this._config.repository.octokit .rest.pulls.create({
34881+ return this._octokit .rest.pulls.create({
3488134882 owner: this._config.repository.owner,
3488234883 repo: this._config.repository.repo,
3488334884 title: this._config.repository.pullRequest.title,
3488434885 body: this._config.repository.pullRequest.body,
3488534886 head: this.branchName(),
34886- base: defaultBranch
34887+ base: defaultBranch,
3488734888 });
3488834889 }
3488934890 catch (error) {
@@ -34894,11 +34895,11 @@ class Repository {
3489434895 }
3489534896 async assignee(issueNumber, assignees) {
3489634897 try {
34897- return this._config.repository.octokit .rest.issues.addAssignees({
34898+ return this._octokit .rest.issues.addAssignees({
3489834899 owner: this._config.repository.owner,
3489934900 repo: this._config.repository.repo,
3490034901 issue_number: issueNumber,
34901- assignees: assignees
34902+ assignees: assignees,
3490234903 });
3490334904 }
3490434905 catch (error) {
@@ -34909,11 +34910,11 @@ class Repository {
3490934910 }
3491034911 async addLabels(issueNumber, labels) {
3491134912 try {
34912- return this._config.repository.octokit .rest.issues.addLabels({
34913+ return this._octokit .rest.issues.addLabels({
3491334914 owner: this._config.repository.owner,
3491434915 repo: this._config.repository.repo,
3491534916 issue_number: issueNumber,
34916- labels
34917+ labels,
3491734918 });
3491834919 }
3491934920 catch (error) {
@@ -34923,8 +34924,8 @@ class Repository {
3492334924 }
3492434925 }
3492534926 branchName() {
34926- if (this._currentBranch === '' ) {
34927- this._currentBranch = this._config.repository.commit.branch.replace(' {random}' , (0, randomizer_1.randomizer)());
34927+ if (this._currentBranch === "" ) {
34928+ this._currentBranch = this._config.repository.commit.branch.replace(" {random}" , (0, randomizer_1.randomizer)());
3492834929 }
3492934930 return this._currentBranch;
3493034931 }
0 commit comments