Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch Discourse usernames from smart contract (#85) #89

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/discourse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Discourse Usernames

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: data-sources/discourse/
strategy:
matrix:
node-version: [16.x, 18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: data-sources/discourse/package-lock.json
- run: npm install
- run: npm run lint
- run: npm run build
39 changes: 38 additions & 1 deletion .github/workflows/generate-datasets-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,46 @@ jobs:
- name: Push Changes
run: git push

sourcecred:
discourse:
needs: github
runs-on: ubuntu-latest
defaults:
run:
working-directory: data-sources/discourse/
steps:
- uses: actions/checkout@v3

- name: Pull changes
run: |
git fetch
git pull

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: npm
cache-dependency-path: data-sources/discourse/package-lock.json

- name: Install Node.js Packages 🔧
run: npm install

- run: npm run build
- run: npm run generate-csv

- name: Commit Changes
run: |
git config user.name 'NationCred bot'
git config user.email '[email protected]'
git add output/*
git commit --allow-empty -m 'generate discourse dataset'

- name: Push Changes
run: git push

sourcecred:
needs: discourse
runs-on: ubuntu-latest
defaults:
run:
working-directory: data-sources/sourcecred/
Expand Down
23 changes: 23 additions & 0 deletions data-sources/discourse/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-var-requires": 0
}
}
35 changes: 35 additions & 0 deletions data-sources/discourse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Discourse

https://forum.nation3.org/

## Datasets

- `output/discourse-usernames.csv`

Contains the link between a Discourse username and an Ethereum address.

## Install

```
npm install
```

## Lint

```
npm run lint
```

## Build & Run

### Build

```
npm run build
```

### Generate Usernames CSV

```
npm run generate-csv
```
43 changes: 43 additions & 0 deletions data-sources/discourse/abis/Discourse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"abi": [{
"anonymous": false,
"inputs": [],
"name": "UsernameDeleted",
"type": "event"
}, {
"anonymous": false,
"inputs": [],
"name": "UsernameUpdated",
"type": "event"
}, {
"inputs": [],
"name": "deleteUsername",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}, {
"inputs": [{
"internalType": "string",
"name": "username",
"type": "string"
}],
"name": "updateUsername",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}, {
"inputs": [{
"internalType": "address",
"name": "",
"type": "address"
}],
"name": "usernames",
"outputs": [{
"internalType": "string",
"name": "",
"type": "string"
}],
"stateMutability": "view",
"type": "function"
}]
}
Loading