Skip to content

Generate repository list #30839

Generate repository list

Generate repository list #30839

Workflow file for this run

name: Generate repository list
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *' # Every hour
jobs:
repo-list:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get repos
uses: actions/github-script@v4
with:
github-token: ${{secrets.GH_EA_TOKEN}}
script: |
const fs = require("fs")
let repoResult = []
await github.paginate(github.repos.listForOrg, {
org: "octo-faq",
type: "public",
headers: {
"accept": "application/vnd.github.mercy-preview+json"
}
}).then(repos => {
console.log(repos)
for(let repo of repos) {
let {name, full_name, description, html_url, language, stargazers_count, watchers_count, forks_count, topics} = repo
if (topics.includes("example-project")) {
repoResult.push({name, full_name, description, html_url, language, stargazers_count, watchers_count, forks_count, topics})
}
}
})
console.log(repoResult)
fs.writeFileSync('repositories.json', JSON.stringify(repoResult))
- name: Save the repos
run: |
git config user.name github-actions
git config user.email [email protected]
git add .
git commit --allow-empty -m "latest list of repos"
git push