Skip to content
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/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
jobs:
generate-page:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6

Expand All @@ -27,13 +29,39 @@ jobs:
python src/scripts/generate_page.py
python src/scripts/generate_workflow_md.py

- name: Upload page data
uses: actions/upload-artifact@v4
with:
name: generated-data
path: static/data/*.json

- name: Upload workflow data
uses: actions/upload-artifact@v4
with:
name: generated-workflows
path: docs/workflows/all_workflows/*.md

build:
name: Build Docusaurus
runs-on: ubuntu-latest
needs: generate-page
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Download generated data
uses: actions/download-artifact@v4
with:
name: generated-data
path: static/data/

- name: Download generated workflows
uses: actions/download-artifact@v4
with:
name: generated-workflows
path: docs/workflows/all_workflows/

- uses: actions/setup-node@v6
with:
node-version: 18
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
generate-page:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6

Expand All @@ -25,19 +27,46 @@ jobs:
python src/scripts/generate_page.py
python src/scripts/generate_workflow_md.py

- name: Upload page data
uses: actions/upload-artifact@v4
with:
name: generated-data
path: static/data/*.json

- name: Upload workflow data
uses: actions/upload-artifact@v4
with:
name: generated-workflows
path: docs/workflows/all_workflows/*.md

test-deploy:
name: Test deployment
runs-on: ubuntu-latest
needs: generate-page
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Download generated data
uses: actions/download-artifact@v4
with:
name: generated-data
path: static/data/

- name: Download generated workflows
uses: actions/download-artifact@v4
with:
name: generated-workflows
path: docs/workflows/all_workflows/

- uses: actions/setup-node@v6
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci

- name: Test build website
run: npm run build
15 changes: 12 additions & 3 deletions src/scripts/generate_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ def get_total_commits(repo):
return counts


def get_total_deployments(repo):
"""Get total deployments in a repository."""
try:
counts = repo.get_deployments().totalCount
except:
counts = 0
return counts


def get_commit_history(repo):
"""Get commit history for a repository."""
total = get_total_commits(repo)
Expand Down Expand Up @@ -80,9 +89,9 @@ def get_config_readme(repo_name):
# ----------------------------
# query information from github about the organization
gh_instance = Github(auth=Auth.Token(os.environ["GITHUB_TOKEN"]))
logger.info("authenticated to Github as %s", gh_instance.get_user().login)
logger.info("authenticated to Github API")
gh_org = gh_instance.get_organization("MPUSP")
logger.info("fetching data for organization %s", gh_org.login)
logger.info("fetching data for organization")

# get members and their stats
members = {}
Expand Down Expand Up @@ -123,7 +132,7 @@ def get_config_readme(repo_name):
else None
),
"contributors": repo.get_contributors().totalCount,
"deployments": repo.get_deployments().totalCount,
"deployments": get_total_deployments(repo),
"downloads": sum(
asset.download_count
for release in repo.get_releases()
Expand Down
Loading