Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
OR13 committed Aug 11, 2024
1 parent ffee87b commit b1ef080
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,15 @@ jobs:
neo4j-password: ${{ secrets.NEO4J_PASSWORD }}
transmute: |
graph assist ./tests/fixtures/issuer-claims.json --verbose --credential-type application/vc --graph-type application/gql --push
- name: Push Presentations
id: update_graph
uses: ./
with:
neo4j-uri: ${{ secrets.NEO4J_URI }}
neo4j-user: ${{ secrets.NEO4J_USERNAME }}
neo4j-password: ${{ secrets.NEO4J_PASSWORD }}
transmute-client-id: ${{ secrets.CLIENT_ID }}
transmute-client-secret: ${{ secrets.CLIENT_SECRET }}
transmute-api: ${{ secrets.API_BASE_URL }}
transmute: |
graph assist --verbose --graph-type application/gql --push
13 changes: 12 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,18 @@ inputs:
description: |
Neo4j Password.
require: false

transmute-client-id:
description: |
OAuth2 Client ID.
require: false
transmute-client-secret:
description: |
OAuth2 Client Secret.
require: false
transmute-api:
description: |
Resource Owner API.
require: false
outputs:
yaml:
description: "The output as yaml."
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions rotate-action-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ source $1
gh secret set NEO4J_URI --body "$NEO4J_URI"
gh secret set NEO4J_USERNAME --body "$NEO4J_USERNAME"
gh secret set NEO4J_PASSWORD --body "$NEO4J_PASSWORD"

gh secret set TOKEN_AUDIENCE --body "$TOKEN_AUDIENCE"
gh secret set TOKEN_ENDPOINT --body "$TOKEN_ENDPOINT"
gh secret set API_BASE_URL --body "$API_BASE_URL"
gh secret set CLIENT_ID --body "$CLIENT_ID"
gh secret set CLIENT_SECRET --body "$CLIENT_SECRET"
12 changes: 2 additions & 10 deletions src/graph/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import { env } from '../action'
import { jsongraph } from './graph/jsongraph'
import { query, injection } from './graph/gql'
import { driver, push } from './graph/driver'

import dotenv from 'dotenv'

import VerifiableDataPlatform from '@transmute/sdk'
import { getPresentations } from './presentations'
import { getApi, getPresentations } from './presentations'

export const handler = async function ({ positionals, values }: Arguments) {
positionals = positionals.slice(1)
Expand All @@ -36,12 +33,7 @@ export const handler = async function ({ positionals, values }: Arguments) {
if (!pathToContent) {
let allGraphText = ''
const allGraphs = [] as any[]
const api = await VerifiableDataPlatform.fromEnv({
CLIENT_ID: process.env.CLIENT_ID as string,
CLIENT_SECRET: process.env.CLIENT_SECRET as string,
API_BASE_URL: process.env.API_BASE_URL as string,
TOKEN_AUDIENCE: process.env.TOKEN_AUDIENCE as string,
})
const api = await getApi()
const { items } = await getPresentations({ sent: true, received: true, api })
const d = await driver()
const session = d.session()
Expand Down
13 changes: 13 additions & 0 deletions src/graph/presentations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@


import VerifiableDataPlatform from '@transmute/sdk'
import { getInput } from '@actions/core'

export const getApi = async () => {
return await VerifiableDataPlatform.fromEnv({
CLIENT_ID: `${process.env.CLIENT_ID || getInput("transmute-client-id")}`,
CLIENT_SECRET: `${process.env.CLIENT_SECRET || getInput("transmute-client-secret")}`,
API_BASE_URL: `${process.env.API_BASE_URL || getInput("transmute-api")}`,
TOKEN_AUDIENCE: `${process.env.API_BASE_URL || getInput("transmute-api")}`,
})
}

export const getPresentations = async ({ sent, received, api }: any) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const results: any = { items: [] }
Expand Down
2 changes: 1 addition & 1 deletion tests/graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ it.skip('graph assist credential', async () => {
})

it.skip('graph assist presentation', async () => {
await facade(`graph assist --verbose --credential-type application/vc --graph-type application/gql --push --env ./.env`)
await facade(`graph assist --verbose --graph-type application/gql --push --env ./.env`)
expect(debug).toHaveBeenCalledTimes(1)
expect(output).toHaveBeenCalledTimes(1)
})

0 comments on commit b1ef080

Please sign in to comment.