This commit is contained in:
tree🌴 2024-03-03 21:52:22 +01:00
parent 7af233658a
commit 298a972ed7
6 changed files with 331 additions and 2 deletions

30
.github/workflows/sync.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: Synchronize data
on:
schedule:
- cron: '0 */1 * * *'
workflow_dispatch:
permissions:
contents: write
id-token: write
pages: write
actions: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v3
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Run synchronization script
run: make sync
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions

View file

@ -6,6 +6,9 @@ cache:
build: build:
deno run --allow-all utils/build.js deno run --allow-all utils/build.js
sync:
deno run --allow-all utils/sync.js
test: test:
deno test --allow-all utils/test.js deno test --allow-all utils/test.js

View file

@ -118,7 +118,42 @@ $defs:
imageUrl: imageUrl:
type: string type: string
format: uri format: uri
research:
type: object
additionalProperties: false
required:
- issue
- title
- status
properties:
issue:
type: number
title:
type: string
status:
type: string
enum:
- live
- in-progress
- live
- backlog
- deprecated
sort:
type: number
labels:
type: array
items:
type: string
assignees:
type: array
items:
type: string
description:
type: string
caption:
type: string
links:
type: object
type: object type: object
additionalProperties: false additionalProperties: false
properties: properties:
@ -158,3 +193,8 @@ properties:
type: array type: array
items: items:
$ref: "#/$defs/person" $ref: "#/$defs/person"
research:
type: array
items:
$ref: "#/$defs/research"

View file

@ -38,6 +38,8 @@ core-team:
github: coinmandeer github: coinmandeer
matrix: coinmandeer:matrix.org matrix: coinmandeer:matrix.org
twitter: KeenOfCoin twitter: KeenOfCoin
research:
$load: research
projects: projects:
$load: projects $load: projects
people: people:

129
src/research/index.yaml Normal file
View file

@ -0,0 +1,129 @@
# ----
#
# THIS FILE IS GENERATED, PLEASE DO NOT EDIT!
#
# EDIT GITHUB PROJECT/ISSUES INSTEAD:
# https://github.com/orgs/web3privacy/projects/11
#
# ----
- issue: 1
title: ZK solutions DB
status: live
sort: 0
labels:
- db
assignees:
- Msiusko
caption: General DB aggregation focused on ZK for privacy.
links:
web: https://github.com/web3privacy/web3privacy/tree/main/ZKprivacylandscape
docs: https://docs.web3privacy.info/research/zk-solutions
- issue: 2
title: Privacy Use-Cases DB
status: live
sort: 1
labels:
- db
assignees:
- Msiusko
links:
docs: https://docs.web3privacy.info/research/usecase-db
- issue: 3
title: Pagency Framework
status: live
sort: 3
labels: []
assignees:
- Msiusko
links: {}
- issue: 4
title: Privacy Projects Hiring
status: live
sort: 2
labels:
- db
assignees:
- Msiusko
links:
docs: https://docs.web3privacy.info/research/hiring
- issue: 5
title: Privacy Guides
status: backlog
sort: 0
labels: []
assignees: []
links: {}
- issue: 6
title: Hackathon Curation Pack
status: backlog
sort: 2
labels: []
assignees:
- EclecticSamurai
- Msiusko
links: {}
- issue: 7
title: Privacy Annual Report 2024
status: backlog
sort: 3
labels: []
assignees:
- EclecticSamurai
- Msiusko
links: {}
- issue: 8
title: Ethereum Privacy Ecosystem
status: in-progress
sort: 0
labels: []
assignees:
- Msiusko
links: {}
- issue: 9
title: Privacy use-cases DB 2.0 (major update)
status: backlog
sort: 4
labels:
- db
assignees: []
links: {}
- issue: 10
title: Privacy features audit concept for security audit organizations &
whitehackers
status: backlog
sort: 1
labels: []
assignees:
- Msiusko
links: {}
- issue: 11
title: Scoring model for privacy-services
status: in-progress
sort: 1
labels: []
assignees:
- Msiusko
links: {}
- issue: 12
title: Privacy market outlook 22'
status: live
sort: 4
labels: []
assignees:
- Msiusko
links: {}
- issue: 13
title: Privacy use-cases within the Ukrainian-Russian war
status: live
sort: 5
labels: []
assignees:
- Msiusko
links: {}
- issue: 14
title: Privacy market DB
status: live
sort: 6
labels: []
assignees: []
links: {}

125
utils/sync.js Normal file
View file

@ -0,0 +1,125 @@
import "https://deno.land/std@0.218.2/dotenv/load.ts";
import { gql, GraphQLClient } from "https://deno.land/x/graphql_request/mod.ts";
import { stringify } from "npm:yaml";
import { join } from "https://deno.land/std@0.208.0/path/mod.ts";
import fm from "npm:front-matter";
const warningGen = (link) => `# ----
#
# THIS FILE IS GENERATED, PLEASE DO NOT EDIT!
#
# EDIT GITHUB PROJECT/ISSUES INSTEAD:
# ${link}
#
# ----\n`
async function syncResearch () {
const statuses = {
'Live': 'live',
'In progress': 'in-progress',
'Deprecated': 'deprecated',
'Backlog': 'backlog',
}
const client = new GraphQLClient("https://api.github.com/graphql", {
headers: {
authorization: `bearer ${Deno.env.get('GITHUB_TOKEN')}`,
},
});
const query = gql`
query {
organization(login:"web3privacy") {
projectV2(number: 11) {
title
items(first: 100, orderBy: {direction: ASC, field: POSITION} ) {
nodes {
id
fieldValueByName(name: "Status") {
... on ProjectV2ItemFieldSingleSelectValue {
name
}
}
content {
... on Issue {
number
repository {
name
}
title
body
bodyText
state
assignees(first:20) {
nodes {
login
}
}
labels(first: 20) {
nodes {
name
}
}
}
}
}
}
}
#projectsV2(first: 20) {
# nodes {
# id
# title
# }
#}
}
}
`;
const arr = []
const data = await client.request(query);
let counts = {};
for (const item of data.organization.projectV2.items.nodes) {
const c = item.content
if (!c.repository || c.repository.name !== 'research') {
continue
}
const status = statuses[item.fieldValueByName.name]
if (!counts[status]) {
counts[status] = 0
}
const rfm = fm(c.body);
const attrs = rfm.attributes
arr.push({
issue: c.number,
title: c.title,
//state: c.state,
status,
sort: counts[status],
//repo: c.repository?.name,
labels: c.labels?.nodes.map(n => n.name),
assignees: c.assignees?.nodes.map(n => n.login),
caption: attrs.caption,
description: attrs.description,
links: {
web: attrs.link,
docs: attrs.docs
},
//body: c.body,
})
counts[status]++
}
const outArr = arr.sort((x, y) => x.issue > y.issue ? 1 : -1)
const outText = warningGen('https://github.com/orgs/web3privacy/projects/11')+stringify(outArr)
const fn = './src/research/index.yaml'
await Deno.writeTextFile(fn, outText)
console.log(`File written: ${fn}`)
}
await syncResearch()