Skip to content

Analyze Dependents #1094

Analyze Dependents

Analyze Dependents #1094

name: Analyze Dependents
on:
workflow_dispatch:
schedule:
- cron: "0 14 * * *" # daily at 10am EST (Github Actions works with UTC)
jobs:
# clones known dependent Git repositories from Open edX
checkout-dependents:
runs-on: ubuntu-latest
steps:
- name: Checkout openedx/credentials-themes
uses: actions/checkout@v3
with:
repository: openedx/credentials-themes
path: dependent-usage-analyzer/.projects/credentials-themes
- name: Checkout openedx/credentials
uses: actions/checkout@v3
with:
repository: openedx/credentials
path: dependent-usage-analyzer/.projects/credentials
- name: Checkout openedx/edx-enterprise
uses: actions/checkout@v3
with:
repository: openedx/edx-enterprise
path: dependent-usage-analyzer/.projects/edx-enterprise
- name: Checkout openedx/edx-ora2
uses: actions/checkout@v3
with:
repository: openedx/edx-ora2
path: dependent-usage-analyzer/.projects/edx-ora2
- name: Checkout openedx/edx-platform
uses: actions/checkout@v3
with:
repository: openedx/edx-platform
path: dependent-usage-analyzer/.projects/edx-platform
- name: Checkout openedx/frontend-app-account
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-account
path: dependent-usage-analyzer/.projects/frontend-app-account
- name: Checkout openedx/frontend-app-admin-portal
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-admin-portal
path: dependent-usage-analyzer/.projects/frontend-app-admin-portal
- name: Checkout openedx/frontend-app-authn
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-authn
path: dependent-usage-analyzer/.projects/frontend-app-authn
- name: Checkout openedx/frontend-app-communications
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-communications
path: dependent-usage-analyzer/.projects/frontend-app-communications
- name: Checkout openedx/frontend-app-course-authoring
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-course-authoring
path: dependent-usage-analyzer/.projects/frontend-app-course-authoring
- name: Checkout openedx/frontend-app-discussions
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-discussions
path: dependent-usage-analyzer/.projects/frontend-app-discussions
- name: Checkout openedx/frontend-app-ecommerce
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-ecommerce
path: dependent-usage-analyzer/.projects/frontend-app-ecommerce
- name: Checkout openedx/frontend-app-enterprise-public-catalog
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-enterprise-public-catalog
path: dependent-usage-analyzer/.projects/frontend-app-enterprise-public-catalog
- name: Checkout openedx/frontend-app-gradebook
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-gradebook
path: dependent-usage-analyzer/.projects/frontend-app-gradebook
- name: Checkout openedx/frontend-app-learner-portal-enterprise
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-learner-portal-enterprise
path: dependent-usage-analyzer/.projects/frontend-app-learner-portal-enterprise
- name: Checkout openedx/frontend-app-learner-portal-programs
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-learner-portal-programs
path: dependent-usage-analyzer/.projects/frontend-app-learner-portal-programs
- name: Checkout openedx/frontend-app-learner-record
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-learner-record
path: dependent-usage-analyzer/.projects/frontend-app-learner-record
- name: Checkout openedx/frontend-app-learning
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-learning
path: dependent-usage-analyzer/.projects/frontend-app-learning
- name: Checkout openedx/frontend-app-library-authoring
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-library-authoring
path: dependent-usage-analyzer/.projects/frontend-app-library-authoring
- name: Checkout openedx/frontend-app-ora-grading
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-ora-grading
path: dependent-usage-analyzer/.projects/frontend-app-ora-grading
- name: Checkout openedx/frontend-app-payment
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-payment
path: dependent-usage-analyzer/.projects/frontend-app-payment
- name: Checkout openedx/frontend-app-profile
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-profile
path: dependent-usage-analyzer/.projects/frontend-app-profile
- name: Checkout openedx/frontend-app-program-console
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-program-console
path: dependent-usage-analyzer/.projects/frontend-app-program-console
- name: Checkout openedx/frontend-app-publisher
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-publisher
path: dependent-usage-analyzer/.projects/frontend-app-publisher
- name: Checkout openedx/frontend-app-support-tools
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-support-tools
path: dependent-usage-analyzer/.projects/frontend-app-support-tools
- name: Checkout openedx/frontend-component-cookie-policy-banner
uses: actions/checkout@v3
with:
repository: openedx/frontend-component-cookie-policy-banner
path: dependent-usage-analyzer/.projects/frontend-component-cookie-policy-banner
- name: Checkout edx/frontend-component-header-edx
uses: actions/checkout@v3
with:
repository: edx/frontend-component-header-edx
path: dependent-usage-analyzer/.projects/frontend-component-header-edx
- name: Checkout openedx/frontend-component-header
uses: actions/checkout@v3
with:
repository: openedx/frontend-component-header
path: dependent-usage-analyzer/.projects/frontend-component-header
- name: Checkout openedx/frontend-enterprise
uses: actions/checkout@v3
with:
repository: openedx/frontend-enterprise
path: dependent-usage-analyzer/.projects/frontend-enterprise
- name: Checkout openedx/frontend-learner-portal-base
uses: actions/checkout@v3
with:
repository: openedx/frontend-learner-portal-base
path: dependent-usage-analyzer/.projects/frontend-learner-portal-base
- name: Checkout openedx/frontend-lib-special-exams
uses: actions/checkout@v3
with:
repository: openedx/frontend-lib-special-exams
path: dependent-usage-analyzer/.projects/frontend-lib-special-exams
- name: Checkout openedx/frontend-platform
uses: actions/checkout@v3
with:
repository: openedx/frontend-platform
path: dependent-usage-analyzer/.projects/frontend-platform
- name: Checkout openedx/frontend-template-application
uses: actions/checkout@v3
with:
repository: openedx/frontend-template-application
path: dependent-usage-analyzer/.projects/frontend-template-application
- name: Checkout edx/prospectus
uses: actions/checkout@v3
with:
repository: edx/prospectus
path: dependent-usage-analyzer/.projects/prospectus
token: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
- name: Checkout openedx/studio-frontend
uses: actions/checkout@v3
with:
repository: openedx/studio-frontend
path: dependent-usage-analyzer/.projects/studio-frontend
- name: Checkout openedx/frontend-app-communications
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-communications
path: dependent-usage-analyzer/.projects/frontend-app-communications
- name: Checkout openedx/frontend-app-learner-dashboard
uses: actions/checkout@v3
with:
repository: openedx/frontend-app-learner-dashboard
path: dependent-usage-analyzer/.projects/frontend-app-learner-dashboard
- name: Verify checkouts
working-directory: dependent-usage-analyzer
run: ls -la .projects
- name: Create zip archive of dependent project checkouts
uses: montudor/action-zip@v1
with:
args: zip -qq -r dependent-usage-analyzer/dependent-projects.zip dependent-usage-analyzer/.projects
- name: Upload dependent projects checkouts
uses: actions/upload-artifact@v4
with:
name: dependent-project-checkouts
path: dependent-usage-analyzer/dependent-projects.zip
# analyzes the dependent Git repositories
analyze-dependents:
needs: checkout-dependents
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
- name: Install dependencies
run: npm ci
working-directory: dependent-usage-analyzer
- name: Download dependent project checkouts
uses: actions/download-artifact@v4
with:
name: dependent-project-checkouts
path: dependent-usage-analyzer
- name: Unzip archive of dependent project checkouts
uses: montudor/action-zip@v1
with:
args: unzip -qq dependent-usage-analyzer/dependent-projects.zip -d dependent-usage-analyzer/dependent-projects
- name: Move dependent project checkouts
working-directory: dependent-usage-analyzer
run: |
sudo mv dependent-projects/dependent-usage-analyzer/.projects .projects
ls -la .projects
- name: Analyze projects
run: npm run analyze .projects -- --out "${GITHUB_WORKSPACE}/dependent-usage.json"
working-directory: dependent-usage-analyzer
- name: Upload analysis output
uses: actions/upload-artifact@v4
with:
name: dependent-usage-json
path: dependent-usage.json
# automatically open, approve, and merge a PR with the dependent projects analysis output
commit-dependents-analysis:
needs: analyze-dependents
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Nodejs Env
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
- name: Setup Nodejs
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VER }}
- name: Download analysis output
uses: actions/download-artifact@v4
with:
name: dependent-usage-json
- name: Create pull request for dependent project usages
id: cpr
uses: peter-evans/create-pull-request@v3
with:
commit-message: "docs: update dependent-usage.json"
title: "docs: update dependent-usage.json"
body: "Contains automated changes to the dependent-usage.json file, which provides the data for Paragon Usage Insights."
labels: automerge
branch: dependent-usage-analyzer/update-dependent-usage-json
base: master
- name: Auto-approve pull request for dependent project usages
uses: hmarr/auto-approve-action@v2
with:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
github-token: ${{ secrets.requirements_bot_github_token }}
- name: Auto-merge pull request for dependent project usages
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }}
MERGE_METHOD: squash
MERGE_RETRY_SLEEP: 240000