Skip to content

Commit 4dddfe3

Browse files
committed
Run linter
1 parent c2939a2 commit 4dddfe3

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

src/action.ts

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,90 @@
1-
import * as core from '@actions/core'
2-
import * as util from 'util'
3-
import * as child_process from 'child_process'
1+
import * as core from '@actions/core';
2+
import * as util from 'util';
3+
import * as child_process from 'child_process';
44

55
class GitArgs {
6-
readonly command: string
6+
readonly command: string;
77

88
constructor(
99
readonly ref: string,
1010
readonly directory: string
1111
) {
12-
core.debug(`GitArgs.ref: ${ref}`)
13-
core.debug(`GitArgs.directory: ${directory}`)
12+
core.debug(`GitArgs.ref: ${ref}`);
13+
core.debug(`GitArgs.directory: ${directory}`);
1414

15-
this.command = `git -C ${this.directory}`
16-
core.debug(`GitArgs.command: ${this.command}`)
15+
this.command = `git -C ${this.directory}`;
16+
core.debug(`GitArgs.command: ${this.command}`);
1717
}
1818
}
1919

2020
async function exec(command: string) {
21-
core.debug(`executing: ${command}`)
21+
core.debug(`executing: ${command}`);
2222

23-
const { stdout, stderr } = await util.promisify(child_process.exec)(command)
24-
if (stderr) console.error(stderr)
25-
return stdout
23+
const {stdout, stderr} = await util.promisify(child_process.exec)(command);
24+
if (stderr) console.error(stderr);
25+
return stdout;
2626
}
2727

2828
function annotatedTag(message: string, git: GitArgs) {
29-
core.info('Creating annotated tag...')
30-
return exec(`${git.command} tag -a -f -m "${message}" ${git.ref}`)
29+
core.info('Creating annotated tag...');
30+
return exec(`${git.command} tag -a -f -m "${message}" ${git.ref}`);
3131
}
3232

3333
function lightweightTag(git: GitArgs) {
34-
core.info('Creating lightweight tag...')
35-
return exec(`${git.command} tag -f ${git.ref}`)
34+
core.info('Creating lightweight tag...');
35+
return exec(`${git.command} tag -f ${git.ref}`);
3636
}
3737

3838
function forceBranch(git: GitArgs) {
39-
core.info('Updating branch...')
40-
return exec(`${git.command} branch -f ${git.ref}`)
39+
core.info('Updating branch...');
40+
return exec(`${git.command} branch -f ${git.ref}`);
4141
}
4242

4343
async function setupUser(git: GitArgs) {
44-
core.info('Setting up git user...')
44+
core.info('Setting up git user...');
4545

46-
const { GITHUB_ACTOR } = process.env
47-
core.debug(`GITHUB_ACTOR: ${GITHUB_ACTOR}`)
46+
const {GITHUB_ACTOR} = process.env;
47+
core.debug(`GITHUB_ACTOR: ${GITHUB_ACTOR}`);
4848

49-
await exec(`${git.command} config user.name "${GITHUB_ACTOR}"`)
49+
await exec(`${git.command} config user.name "${GITHUB_ACTOR}"`);
5050
await exec(
5151
`${git.command} config user.email "${GITHUB_ACTOR}@users.noreply.github.com"`
52-
)
52+
);
5353
}
5454

5555
async function run() {
5656
try {
5757
const git = new GitArgs(
5858
core.getInput('ref') || core.getInput('tag-name') || 'latest',
5959
core.getInput('git-directory')
60-
)
60+
);
6161

62-
const branch = core.getBooleanInput('force-branch', { required: true })
63-
const message = core.getInput('description')
62+
const branch = core.getBooleanInput('force-branch', {required: true});
63+
const message = core.getInput('description');
6464

6565
if (branch && message)
6666
core.warning(
6767
"You can't set a message when updating a branch, the message will be ignored."
68-
)
68+
);
6969

70-
core.debug(`branch: ${branch}`)
71-
core.debug(`message: ${message}`)
70+
core.debug(`branch: ${branch}`);
71+
core.debug(`message: ${message}`);
7272

73-
core.info(`Running git commands within ${git.directory}`)
74-
core.info(`Using '${git.ref}' as tag name.`)
73+
core.info(`Running git commands within ${git.directory}`);
74+
core.info(`Using '${git.ref}' as tag name.`);
7575

76-
await setupUser(git)
76+
await setupUser(git);
7777

78-
if (branch) await forceBranch(git)
79-
else if (message) await annotatedTag(message, git)
80-
else await lightweightTag(git)
78+
if (branch) await forceBranch(git);
79+
else if (message) await annotatedTag(message, git);
80+
else await lightweightTag(git);
8181

82-
if (branch) core.info('Force-pushing updated branch to repo...')
83-
else core.info('Pushing updated tag to repo...')
84-
return await exec(`${git.command} push --force origin ${git.ref}`)
82+
if (branch) core.info('Force-pushing updated branch to repo...');
83+
else core.info('Pushing updated tag to repo...');
84+
return await exec(`${git.command} push --force origin ${git.ref}`);
8585
} catch (error) {
86-
core.setFailed(error instanceof Error ? error.message : error)
86+
core.setFailed(error instanceof Error ? error.message : error);
8787
}
8888
}
8989

90-
run()
90+
run();

0 commit comments

Comments
 (0)