Skip to content

Commit

Permalink
Tag with changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kpgalligan committed Apr 10, 2024
1 parent d6412d2 commit 6fe45b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 4 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import simpleGit from "simple-git";
import simpleGit from 'simple-git'

Check failure on line 2 in src/main.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Using exported name 'simpleGit' as identifier for default export

Check failure on line 2 in src/main.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

Using exported name 'simpleGit' as identifier for default export

export async function run(): Promise<void> {
try {
Expand All @@ -13,17 +13,20 @@ export async function run(): Promise<void> {
core.debug(`tagVersion: ${tagVersion}`)
core.debug(`branchName: ${branchName}`)

const git = simpleGit();
const git = simpleGit()

const buildBranchName = `build-${tagVersion}`
await git.checkoutLocalBranch(buildBranchName)

const diff = await git.diffSummary()

if (diff.changed > 0) {
await git.add(".")
await git.add('.')
await git.commit(commitMessage)
}

await git.addAnnotatedTag(tagVersion, tagMessage)
await git.raw("push", "origin", "-u", branchName, "--follow-tags")
await git.raw('push', 'origin', '-u', branchName, '--follow-tags')
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
Expand Down

0 comments on commit 6fe45b4

Please sign in to comment.