Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Dec 13, 2022
1 parent f179ff0 commit 7e835e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 42 deletions.
5 changes: 1 addition & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ async function run() {
const { repository } = await tags.getAllTags(owner, repo, myToken);

let tagsObj = tags.getTags(repository);
console.log('REPOSITORY: ', JSON.stringify(tagsObj))
const jsonUtils = new JsonUtils(tagsObj);
if(prefix == '') {
jsonUtils.filterNoPrefix()
Expand All @@ -39,9 +38,7 @@ async function run() {
} else {
newVersion = `${prefix}1.0.0`
}




fs.appendFileSync(process.env.GITHUB_OUTPUT, "version=" + newVersion);
const octokit = github.getOctokit(myToken)

Expand Down
45 changes: 9 additions & 36 deletions src/utils/get-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ module.exports = class GetReleaseTags {


getTags(jsonObj) {
console.log("JSON OBJ: ", JSON.stringify(jsonObj))
// return jsonObj['refs']['nodes'][0]['repository']['releases']['nodes'];
return jsonObj['releases']['nodes'];
}

Expand All @@ -25,47 +23,22 @@ module.exports = class GetReleaseTags {
},
});

console.log(`Owner: ${owner} - Repo: ${repo}`)

// return await graphqlWithAuth(
// `
// {

// repository(owner: "${owner}", name: "${repo}") {
// refs(refPrefix: "refs/tags/", first: 1, query: "v3.0.0") {
// nodes {
// repository {
// releases(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {
// nodes {
// name
// createdAt
// tagName

// }
// }
// }
// }
// }
// }
// }
// `

// );

return await graphqlWithAuth(
`
{
repository(owner: "${owner}", name: "${repo}") {
releases(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {
nodes {
name
createdAt
tagName
releases(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {
nodes {
name
createdAt
tagName
}
}
}
}
}
`
Expand Down
2 changes: 0 additions & 2 deletions src/utils/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ module.exports = class JsonUtils {
}

firstItem(keyName) {
console.log("KEY NAME: ", JSON.stringify(this.jsonObj))
let first = this.jsonObj[0][keyName]
return first
}
Expand Down Expand Up @@ -77,7 +76,6 @@ module.exports = class JsonUtils {
}

filterNoPrefix() {
console.log("INTERNAL OBJ: ", JSON.stringify(this.jsonObj))
let matched = _.filter(this.jsonObj, function(obj) {

let o = obj.tagName.split('.')
Expand Down

0 comments on commit 7e835e7

Please sign in to comment.