Skip to content

Commit

Permalink
Fix dtinth#54
Browse files Browse the repository at this point in the history
  • Loading branch information
wvffle committed Sep 9, 2020
1 parent 825b20a commit 3619624
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.scanCodeRepository = exports.repoContext = void 0;
const core_1 = __webpack_require__(6432);
const fs_1 = __webpack_require__(5747);
const tkt_1 = __webpack_require__(9508);
const child_process_1 = __webpack_require__(3129);
Expand Down Expand Up @@ -121,7 +122,8 @@ function scanCodeRepository() {
if (!process.env.GITHUB_TOKEN) {
throw `Maybe you forgot to enable the GITHUB_TOKEN secret?`;
}
child_process_1.execSync('git push "https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git" HEAD:"$GITHUB_REF"', { stdio: 'inherit' });
const ref = core_1.getInput('branch') || "$GITHUB_REF";
child_process_1.execSync(`git push "https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git" HEAD:${ref}`, { stdio: 'inherit' });
});
},
};
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/CodeRepository.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getInput } from '@actions/core'
import { existsSync, readFileSync } from 'fs'
import { logger, invariant } from 'tkt'
import { execSync, execFileSync } from 'child_process'
Expand Down Expand Up @@ -79,8 +80,10 @@ export async function scanCodeRepository(): Promise<CodeRepositoryState> {
if (!process.env.GITHUB_TOKEN) {
throw `Maybe you forgot to enable the GITHUB_TOKEN secret?`
}

const ref = getInput('branch') || "$GITHUB_REF"
execSync(
'git push "https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git" HEAD:"$GITHUB_REF"',
`git push "https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git" HEAD:${ref}`,
{ stdio: 'inherit' },
)
},
Expand Down

0 comments on commit 3619624

Please sign in to comment.