Scheduled - Update Metadata from Moodle #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Scheduled - Update Metadata from Moodle" | |
on: | |
# Run on cron, every Sunday at 5:30am UTC. | |
schedule: | |
- cron: '30 5 * * 0' | |
# Run on request. | |
workflow_dispatch: | |
inputs: | |
debug: | |
type: boolean | |
required: false | |
description: 'Set the debug mode' | |
jobs: | |
run: | |
# Only run on the canonical repository. | |
if: github.repository == 'moodle/devdocs' | |
name: Fetch the list of components from Moodle | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout DevDocs repo | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Checkout Moodle | |
uses: actions/checkout@v4 | |
with: | |
repository: moodle/moodle.git | |
ref: main | |
path: .moodle | |
# The full history is required to generated the list of contributors. | |
fetch-depth: 0 | |
- name: Ignore Moodle | |
run: | | |
echo '.moodle >> .git/info/exclude' | |
# Note: This will turn into something nicer once we store more metadata about versions and support multiple | |
# Moodle versions. | |
- name: Copy component data | |
run: | | |
cp .moodle/lib/components.json data/main/ | |
- name: Update component data spelling list | |
run: | | |
yarn component-spellings | |
- name: Copy contributor list | |
# Get a list of all contributors to Moodle. | |
# Filter out any containing weird characters, and whose length is three characters or less. | |
working-directory: .moodle | |
run: | | |
../scripts/generate-contributor-list.sh > ../data/moodle-contributors.txt | |
- name: Fetch third-party libraries list | |
run: | | |
yarn libraries-fetch | |
- name: Generate third-party libraries credits | |
run: | | |
yarn libraries-generate | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
add-paths: | | |
data/* | |
general/community/credits/thirdpartylibs.md | |
commit-message: "[repo] Update Moodle Component metadata" | |
title: "[repo] Update Moodle Component metadata" | |
signoff: false | |
delete-branch: true |