Skip to content

Commit

Permalink
update action to use current branch
Browse files Browse the repository at this point in the history
  • Loading branch information
gbonumore committed Jan 26, 2023
1 parent 0f803df commit d40f7f7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
19 changes: 16 additions & 3 deletions 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 dist/index.js.map

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import isEmpty from 'lodash.isempty'
import util from 'util'

type Recipient = {
windowIndex: number
Expand Down Expand Up @@ -83,9 +82,9 @@ async function run(): Promise<void> {

const merkleTrees: QueryResult = await octokit.graphql(
`
query RepoFiles($owner: String!, $name: String!) {
query RepoFiles($owner: String!, $name: String!, $branch: String!) {
repository(owner: $owner, name: $name) {
object(expression: "HEAD:reports") {
object(expression: $branch) {
... on Tree {
entries {
name
Expand All @@ -109,7 +108,8 @@ async function run(): Promise<void> {
}`,
{
owner,
name: repo
name: repo,
branch: `${branchInput}:reports`
}
)

Expand All @@ -121,22 +121,30 @@ async function run(): Promise<void> {
[entry.name]: entry.object.entries.map(el => {
if (el.name === 'merkle-tree-veAUXO.json') {
const date = entry.name
if (!merkleTreesByMonth[date]) {
merkleTreesByMonth[date] = {
veAUXO: {} as MerkleTree,
xAUXO: {} as MerkleTree
}
}
const merkleTree = JSON.parse(el.object.text) as MerkleTree
merkleTreesByMonth[date]['veAUXO'] = merkleTree
}
if (el.name === 'merkle-tree-xAUXO.json') {
const date = entry.name
if (!merkleTreesByMonth[date]) {
merkleTreesByMonth[date] = {
veAUXO: {} as MerkleTree,
xAUXO: {} as MerkleTree
}
}
const merkleTree = JSON.parse(el.object.text) as MerkleTree
merkleTreesByMonth[date]['xAUXO'] = merkleTree
}
})
}
})

// eslint-disable-next-line no-console
console.log(
util.inspect(merkleTreesByMonth, false, null, true /* enable colors */)
)
/**
* Now we have a list of all the merkle trees by month, we need to create a new object
* that has the user as the key and the value is an object with two keys: veAUXO and xAUXO
Expand Down

0 comments on commit d40f7f7

Please sign in to comment.