Skip to content

Commit

Permalink
add contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
mul53 committed Jul 29, 2024
1 parent b14da1c commit b6b8948
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/analyze.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ jobs:
node-version: 14
- run: npm install
- id: analyze
run: npm run analyze
name: Analyze PR
run: |
npm run analyze
[ -f summary.txt ] && echo "{SKIP}={false}" >> "$GITHUB_ENV" || echo "{SKIP}={true}" >> "$GITHUB_ENV"
- uses: mshick/add-pr-comment@v2
if: ${{env.SKIP == true}}
name: Comment on PR
with:
message-path: ./summary.txt
2 changes: 2 additions & 0 deletions contributors
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mul53
darkpaladi
18 changes: 13 additions & 5 deletions scripts/analyze.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
const fs = require('fs/promises')
const Mustache = require('mustache')
const fetch = require('node-fetch')

const isLiquidityValid = require('./helpers/isLiquidityValid')
const isNameValid = require('./helpers/isNameValid')
const isSymbolValid = require('./helpers/isSymbolValid')
const getNewTokenList = require('./helpers/getNewTokenList')
const getCurrentTokenList = require('./helpers/getCurrentTokenList')
const getNewToken = require('./helpers/getNewToken')
const getContributors = require('./helpers/getContributors')

async function analyze() {
const errors = []

const contributors = await getContributors()
const newTokenList = await getNewTokenList()
const currentTokenList = await getCurrentTokenList()

const newToken = await getNewToken(newTokenList, currentTokenList)

if (!newToken) return
if (!newToken) {

return
}

const nameError = await isNameValid(newToken, currentTokenList)
if (nameError) errors.push(nameError)
Expand All @@ -34,7 +37,8 @@ async function analyze() {
symbol: newToken.symbol,
decimals: newToken.decimals,
logoURI: newToken.logoURI,
errors: errors,
contributors: contributors.map(c => `@${c}`).join(" "),
errors,
}

const summary = Mustache.render(
Expand All @@ -48,8 +52,12 @@ async function analyze() {
❌{{.}}
{{/errors}}
{{/errors.length}}
{{^errors.length}}
Token check ok:
{{/errors.length}}
![{{name}} logo]({{{logoURI}}})
@mul53 @darkpaladi
{{contributors}}
`,
view,
)
Expand Down
6 changes: 6 additions & 0 deletions scripts/helpers/getContributors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const fs = require('fs/promises')

module.exports = async function getContributors() {
const contributors = await fs.readFile('./contributors', { encoding: 'utf8' })
return contributors.split('\n')
}

0 comments on commit b6b8948

Please sign in to comment.