Skip to content

Commit

Permalink
feat: force fetch current tag when workflow was started from tag
Browse files Browse the repository at this point in the history
closes: #13
  • Loading branch information
DenKoren committed Feb 17, 2022
1 parent d352049 commit 20daa42
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 28 deletions.
40 changes: 39 additions & 1 deletion actions/detect-version/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 actions/detect-version/dist/index.js.map

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions actions/detect-version/lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ const utils_1 = require("./utils");
const milib_1 = require("milib");
function prepareRepository(depth) {
return __awaiter(this, void 0, void 0, function* () {
// We have to do black magic here because of
// https://github.com/milaboratory/github-ci/issues/13
const refType = process.env.GITHUB_REF_TYPE;
const refName = process.env.GITHUB_REF_NAME;
if (refType === 'tag') {
yield milib_1.git.fetch({
remote: 'origin',
refSpec: `refs/tags/${refName}:refs/tags/${refName}`,
deepen: 1,
forceFlag: true
});
}
yield milib_1.git.fetchTags();
return milib_1.git.ensureHistorySize(depth);
});
Expand Down
14 changes: 14 additions & 0 deletions actions/detect-version/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ import {canonizeVersion, sanitizeVersion} from './utils'
import {git} from 'milib'

async function prepareRepository(depth: number): Promise<void> {
// We have to do black magic here because of
// https://github.com/milaboratory/github-ci/issues/13
const refType: string = process.env.GITHUB_REF_TYPE as string
const refName: string = process.env.GITHUB_REF_NAME as string

if (refType === 'tag') {
await git.fetch({
remote: 'origin',
refSpec: `refs/tags/${refName}:refs/tags/${refName}`,
deepen: 1,
forceFlag: true
})
}

await git.fetchTags()
return git.ensureHistorySize(depth)
}
Expand Down
58 changes: 32 additions & 26 deletions actions/node_modules/milib/lib/git.d.ts

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

0 comments on commit 20daa42

Please sign in to comment.