|
1 | | -import { cwd, readConfig, readFile, writeFile } from './utils/filesystem' |
| 1 | +import { cwd, readConfig } from './utils/filesystem' |
2 | 2 | import { context, getOctokit } from '@actions/github' |
3 | 3 | import { parse } from './utils/inputs' |
4 | 4 | import { info } from '@actions/core' |
5 | 5 | import { Config } from './types/config' |
6 | 6 | import { Repository } from './utils/repository' |
7 | | -import { setPreview } from './utils/preview' |
8 | | -import { setOutputs } from './utils/outputs' |
9 | 7 |
|
10 | 8 | const previewUpdater = async () => { |
11 | 9 | // Inputs |
@@ -35,44 +33,44 @@ const previewUpdater = async () => { |
35 | 33 | // Checkout branch |
36 | 34 | const branchExists = await repo.branchExists() |
37 | 35 | 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) |
76 | 74 | } |
77 | 75 |
|
78 | 76 | export default previewUpdater |
0 commit comments