mirror of
https://github.com/ButlerLogic/action-autotag.git
synced 2025-09-15 09:34:03 +07:00
WIP
This commit is contained in:
17
lib/main.js
17
lib/main.js
@ -1,16 +1,19 @@
|
||||
// import * as core from '@actions/core';
|
||||
const github = require('@actions/github')
|
||||
const core = require('@actions/core')
|
||||
const exec = require('@actions/exec')
|
||||
const io = require('@actions/io')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
const gitpath = await io.which('git', true)
|
||||
await exec.exec(`"${gitpath}"`, ['fetch'])
|
||||
await exec.exec(`"${gitpath}"`, ['checkout', process.env.GITHUB_SHA])
|
||||
// await exec.exec(`git fetch && git checkout ${process.env.GITHUB_SHA}`)
|
||||
// const myToken = core.getInput('myToken');
|
||||
// const octokit = new github.GitHub(myToken)
|
||||
// const myInput = core.getInput('myInput')
|
||||
// core.debug(`Hello ${myInput}`)
|
||||
core.warning(process.env.INPUT_GITHUB_TOKEN)
|
||||
const git = new github.GitHub(process.env.INPUT_GITHUB_TOKEN)
|
||||
core.warning(` Available environment variables:\n -> ${Object.keys(process.env).map(i => i + ' :: ' + process.env[i]).join('\n -> ')}`)
|
||||
|
||||
let dir = fs.readdirSync(path.resolve(process.env.GITHUB_WORKSPACE), { withFileTypes: true }).map(entry => {
|
||||
@ -25,7 +28,11 @@ async function run() {
|
||||
|
||||
// core.warning(` Alt Working Directory: ${process.env.RUNNER_WORKSPACE}:\n${dir2}`)
|
||||
|
||||
console.log(fs.readFileSync(path.join(process.env.GITHUB_WORKSPACE, 'package.json')).toString())
|
||||
let pkg = require(fs.readFileSync(path.join(process.env.GITHUB_WORKSPACE, 'package.json')))
|
||||
|
||||
core.warning(` ${pkg.version}`)
|
||||
|
||||
git.
|
||||
|
||||
core.setOutput('tag', '')
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user