Skip to content

Commit 03a731c

Browse files
Remove unused modules and comment out preview update logic for future refactoring
1 parent 692350b commit 03a731c

1 file changed

Lines changed: 39 additions & 41 deletions

File tree

src/main.ts

Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { cwd, readConfig, readFile, writeFile } from './utils/filesystem'
1+
import { cwd, readConfig } from './utils/filesystem'
22
import { context, getOctokit } from '@actions/github'
33
import { parse } from './utils/inputs'
44
import { info } from '@actions/core'
55
import { Config } from './types/config'
66
import { Repository } from './utils/repository'
7-
import { setPreview } from './utils/preview'
8-
import { setOutputs } from './utils/outputs'
97

108
const previewUpdater = async () => {
119
// Inputs
@@ -35,44 +33,44 @@ const previewUpdater = async () => {
3533
// Checkout branch
3634
const branchExists = await repo.branchExists()
3735
info(`Checkout ${ branchExists ? 'existing' : 'new' } branch named "${ repo.branchName() }"`)
38-
await repo.checkoutBranch(! branchExists)
39-
40-
console.log('aaaa', branchExists)
41-
42-
// Read file
43-
const content = readFile(config, config.path.readme)
44-
const preview = setPreview(content, config)
45-
46-
if (content !== preview) {
47-
info(`Update readme in "${ config.path.readme }" file`)
48-
writeFile(config, config.path.readme, preview)
49-
} else {
50-
info(`File "${ config.path.readme }" is up to date`)
51-
}
52-
53-
// Stage and commit changes
54-
await repo.stage()
55-
await repo.commit()
56-
await repo.push()
57-
58-
// Create a Pull Request
59-
const pullRequest = await repo.createPullRequest()
60-
61-
// Variables
62-
const pullRequestNumber: number = pullRequest.data.number
63-
const pullRequestUrl: string = pullRequest.data.html_url
64-
65-
if (config.repository.pullRequest.assignees.length > 0) {
66-
await repo.assignee(pullRequestNumber, config.repository.pullRequest.assignees)
67-
}
68-
69-
if (config.repository.pullRequest.labels.length > 0) {
70-
await repo.addLabels(pullRequestNumber, config.repository.pullRequest.labels)
71-
}
72-
73-
info(`Preview created in pull request #${ pullRequestNumber }: ${ pullRequestUrl }`)
74-
75-
setOutputs(repo.branchName(), pullRequestNumber, pullRequestUrl)
36+
// await repo.checkoutBranch(! branchExists)
37+
//
38+
// console.log('aaaa', branchExists)
39+
//
40+
// // Read file
41+
// const content = readFile(config, config.path.readme)
42+
// const preview = setPreview(content, config)
43+
//
44+
// if (content !== preview) {
45+
// info(`Update readme in "${ config.path.readme }" file`)
46+
// writeFile(config, config.path.readme, preview)
47+
// } else {
48+
// info(`File "${ config.path.readme }" is up to date`)
49+
// }
50+
//
51+
// // Stage and commit changes
52+
// await repo.stage()
53+
// await repo.commit()
54+
// await repo.push()
55+
//
56+
// // Create a Pull Request
57+
// const pullRequest = await repo.createPullRequest()
58+
//
59+
// // Variables
60+
// const pullRequestNumber: number = pullRequest.data.number
61+
// const pullRequestUrl: string = pullRequest.data.html_url
62+
//
63+
// if (config.repository.pullRequest.assignees.length > 0) {
64+
// await repo.assignee(pullRequestNumber, config.repository.pullRequest.assignees)
65+
// }
66+
//
67+
// if (config.repository.pullRequest.labels.length > 0) {
68+
// await repo.addLabels(pullRequestNumber, config.repository.pullRequest.labels)
69+
// }
70+
//
71+
// info(`Preview created in pull request #${ pullRequestNumber }: ${ pullRequestUrl }`)
72+
//
73+
// setOutputs(repo.branchName(), pullRequestNumber, pullRequestUrl)
7674
}
7775

7876
export default previewUpdater

0 commit comments

Comments
 (0)