Windows support, history results always use \n

This commit is contained in:
Paul Hatcherian 2020-10-07 19:36:05 -04:00
parent 65140edf77
commit b38e4671e9
3 changed files with 7 additions and 5 deletions

2
dist/index.js vendored
View file

@ -1021,7 +1021,7 @@ exports.issueCommand = issueCommand;
const core = __webpack_require__(470); const core = __webpack_require__(470);
const exec = __webpack_require__(986); const exec = __webpack_require__(986);
const eol = __webpack_require__(87).EOL; const eol = '\n';
const tagPrefix = core.getInput('tag_prefix') || ''; const tagPrefix = core.getInput('tag_prefix') || '';
const namespace = core.getInput('namespace') || ''; const namespace = core.getInput('namespace') || '';

View file

@ -1,6 +1,6 @@
const core = require('@actions/core'); const core = require('@actions/core');
const exec = require("@actions/exec"); const exec = require("@actions/exec");
const eol = require('os').EOL; const eol = '\n';
const tagPrefix = core.getInput('tag_prefix') || ''; const tagPrefix = core.getInput('tag_prefix') || '';
const namespace = core.getInput('namespace') || ''; const namespace = core.getInput('namespace') || '';

View file

@ -2,6 +2,7 @@ const cp = require('child_process');
const path = require('path'); const path = require('path');
const process = require('process'); const process = require('process');
const os = require('os'); const os = require('os');
const windows = process.platform === "win32";
// Action input variables // Action input variables
const defaultInputs = { const defaultInputs = {
@ -34,9 +35,9 @@ const createTestRepo = (inputs) => {
let i = 1; let i = 1;
return { return {
clean: () => execute(os.tmpdir(), `rm -rf ${repoDirectory}`), clean: () => execute(os.tmpdir(), windows ? `rmdir /s /q ${repoDirectory}` : `rm -rf ${repoDirectory}`),
makeCommit: (msg, path) => { makeCommit: (msg, path) => {
if (process.platform === "win32") { if (windows) {
run(`fsutil file createnew ${path !== undefined ? path.trim('/') + '/' : ''}test${i++} 0`); run(`fsutil file createnew ${path !== undefined ? path.trim('/') + '/' : ''}test${i++} 0`);
} else { } else {
run(`touch ${path !== undefined ? path.trim('/') + '/' : ''}test${i++}`); run(`touch ${path !== undefined ? path.trim('/') + '/' : ''}test${i++}`);
@ -282,7 +283,8 @@ test('Tag order comes from commit order, not tag create order', () => {
repo.makeCommit('Second Commit'); // 0.0.1+1 repo.makeCommit('Second Commit'); // 0.0.1+1
repo.makeCommit('Third Commit'); // 0.0.1+2 repo.makeCommit('Third Commit'); // 0.0.1+2
repo.exec('git tag v2.0.0'); repo.exec('git tag v2.0.0');
repo.exec('sleep 2'); // Can't timeout in this context on Windows, ping localhost to delay
repo.exec(windows ? 'ping 127.0.0.1 -n 2' : 'sleep 2');
repo.exec('git tag v1.0.0 HEAD~1'); repo.exec('git tag v1.0.0 HEAD~1');
repo.makeCommit('Fourth Commit'); // 0.0.1+2 repo.makeCommit('Fourth Commit'); // 0.0.1+2