{"id":19591918,"url":"https://github.com/catalyst/catalyst-moodle-workflows","last_synced_at":"2026-03-05T20:04:30.278Z","repository":{"id":37103083,"uuid":"438054794","full_name":"catalyst/catalyst-moodle-workflows","owner":"catalyst","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-02T01:59:43.000Z","size":311,"stargazers_count":6,"open_issues_count":40,"forks_count":12,"subscribers_count":17,"default_branch":"main","last_synced_at":"2026-03-02T05:15:35.912Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catalyst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-12-13T23:24:16.000Z","updated_at":"2026-03-02T01:59:45.000Z","dependencies_parsed_at":"2024-01-02T04:24:21.766Z","dependency_job_id":"f6653721-bf6a-4b43-9c00-05798b393da1","html_url":"https://github.com/catalyst/catalyst-moodle-workflows","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/catalyst/catalyst-moodle-workflows","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fcatalyst-moodle-workflows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fcatalyst-moodle-workflows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fcatalyst-moodle-workflows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fcatalyst-moodle-workflows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catalyst","download_url":"https://codeload.github.com/catalyst/catalyst-moodle-workflows/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fcatalyst-moodle-workflows/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30148043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T16:58:46.102Z","status":"ssl_error","status_checked_at":"2026-03-05T16:58:45.706Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T08:31:52.023Z","updated_at":"2026-03-05T20:04:30.272Z","avatar_url":"https://github.com/catalyst.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reusable Workflows\n\nThanks to the new GitHub Actions feature called \"Reusable Workflows\" we can now reference an existing workflow with a single line of configuration rather than copying and pasting from one workflow to another.\n\nThis massively reduces the amount of boilerplate setup in each plugin to the bare minimum and also means that we can maintain and revise our definition of best practice in one place and have all the Moodle plugins inherit improvements in lock step. Mostly these shared actions in turn wrap the Moodle plugin CI scripts:\n\nhttps://moodlehq.github.io/moodle-plugin-ci/\n\n## :rocket: Quick start\n\nFor most plugins, you'll want to go through this checklist:\n\n1. Ensure branch section in `README.md` describes correct versions supported\n2. Supported range in `version.php` has been configured correctly\n3. Workflow file has been added `.github/workflows/ci.yml` and configured\n4. CI badge has been properly added in the `README.md`\n\nSome examples of usage: [tool_mfa](https://github.com/catalyst/moodle-tool_mfa#branches), [tool_dataflows](https://github.com/catalyst/moodle-tool_dataflows/#branches)\n\n\n### Configure support range\n\nEach plugin should have a measurable range of versions supported. It's recommended and ensures a predictable test range.\n\n1. Open `version.php` in your plugin repository\n2. Set the `$plugin-\u003esupported`* as the range the plugin supports, which then determines the versions the workflow tests for.\n\n```php\n# version.php\n$plugin-\u003esupported = [35, 402];\n```\nThis example will run a matrix of tests from `MOODLE_35_STABLE` to `MOODLE_402_STABLE` - [see full test matrix here](.github/actions/matrix/matrix_includes.yml).\n\nAny number _greater_ than the [latest available stable branch](https://github.com/moodle/moodle/branches/active) will automatically include the [main branch](https://github.com/moodle/moodle/tree/main) for testing\n\n\\* For more info on the `$plugin-\u003esupported` field, please see https://docs.moodle.org/dev/version.php\n\n\n### Add the workflow\n\nFor most cases, this following demonstrates how your workflow file would typically look.\n\nCreate `.github/workflows/ci.yml` with the below template in your plugin\nrepository.\n```yaml\n# .github/workflows/ci.yml\nname: ci\n\non: [push, pull_request]\n\njobs:\n  ci:\n    uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@main\n    # Required if you plan to publish (uncomment the below)\n    # secrets:\n      # moodle_org_token: ${{ secrets.MOODLE_ORG_TOKEN }}\n    with:\n      # Any further options in this section\n```\nFor how to set up the secret, please see the [_How does this automate releases_](#how-does-this-automate-releases) section below.\n\nYou can add extra options to disable checks that you might not want, or to add additional dependencies under the `with` field. For example:\n```yaml\n    with:\n      disable_behat: true\n      disable_grunt: true\n      extra_plugin_runners: 'moodle-plugin-ci add-plugin catalyst/moodle-local_aws'\n```\n\n\n#### `with` options\n\nBelow lists the available inputs which are _all optional_:\n\n| Inputs                   | Description                                                                                                                                                                              |\n|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| codechecker_max_warnings | To fail on warnings, set this to 0                                                                                                                                                       |\n| extra_plugin_runners     | Command to install more dependencies                                                                                                                                                     |\n| disable_behat            | Set `true` to disable behat tests.                                                                                                                                                       |\n| disable_phpdoc           | Set `true` to disable phpdoc tests.                                                                                                                                                      |\n| disable_phpcs            | Set `true` to disable phpcs (codechecker) tests.                                                                                                                                         |\n| disable_phplint          | Set `true` to disable phplint tests.                                                                                                                                                     |\n| disable_phpunit          | Set `true` to disable phpunit tests.                                                                                                                                                     |\n| disable_grunt            | Set `true` to disable grunt.                                                                                                                                                             |\n| disable_mustache         | Set `true` to disable mustache.                                                                                                                                                          |\n| disable_master           | If `true`, this will skip testing against moodle/master branch                                                                                                                           |\n| disable_release          | If `true`, this will skip the release job                                                                                                                                                     |\n| disable_ci_validate      | If `true`, this will skip moodle-plugin-ci validate checks                                                                                                                               |\n| enable_phpmd             | If `true`, to enable phpmd                                                                                                                                                               |\n| release_branches         | Name of the non-standardly named branch which should run the release job                                                                                                                 |\n| moodle_branches          | Specify the MOODLE_XX_STABLE branch you specifically want to test against. This is _not_ recommended, and instead you should configuring a supported range.                              |\n| min_php                  | The minimum php version to test. Set this to support the minimum php version supported by the plugin. Defaults to '7.4', however more recent Moodle branches only test higher versions.  |\n| ignore_paths             | Specify custom paths for CI to ignore. Third party libraries are ignored by default. |\n\n### Running with dependencies\nIf you'd require to run your workflow against specific versions of a plugin you depend on, then you can specify a branch you'd like to run each job against. Like following:   \n\n```yaml\njobs:\n  moodle41:\n    uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@main\n    with:\n      disable_phpunit: true\n      moodle_branches: MOODLE_401_STABLE\n      extra_plugin_runners:\n        moodle-plugin-ci add-plugin danmarsden/moodle-mod_attendance --branch MOODLE_401_STABLE\n\n  moodle42:\n    uses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@main\n    with:\n      disable_phpunit: true\n      moodle_branches: MOODLE_402_STABLE\n      extra_plugin_runners:\n        moodle-plugin-ci add-plugin danmarsden/moodle-mod_attendance --branch MOODLE_402_STABLE\n```\n\nAn example can be found here - https://github.com/danmarsden/moodle-block_attendance/blob/main/.github/workflows/ci.yml\n\n### Add CI badge\n\nWith badges, we will be able to see at a glance from the plugin's `README.md` whether or not the plugin is in a good state for usage.\n\n```\n[![ci](https://github.com/[user]/[plugin]/actions/workflows/ci.yml/badge.svg?branch=[branch])](https://github.com/[user]/[plugin]/actions/workflows/ci.yml?branch=[branch])\n```\n\nPlease update `[USER]`, `[PLUGIN]` and `[BRANCH]` in the example above. This goes under the plugin title. Here is an example:\n\n```\n[![ci](https://github.com/catalyst/moodle-tool_excimer/actions/workflows/ci.yml/badge.svg?branch=MOODLE_35_STABLE)](https://github.com/catalyst/moodle-tool_excimer/actions/workflows/ci.yml?branch=MOODLE_35_STABLE)\n\u003c/a\u003e\n```\n\nwhich renders as:\n\n[![ci](https://github.com/catalyst/moodle-tool_excimer/actions/workflows/ci.yml/badge.svg?branch=MOODLE_35_STABLE)](https://github.com/catalyst/moodle-tool_excimer/actions/workflows/ci.yml?branch=MOODLE_35_STABLE)\n\n## How does this automate tests?\nWhen you call the reusable ci, it will:\n1. a check to see what versions of moodle should run, based on the `version.php` file included in the plugin repository.\n2. This will then build out the combination of tests to run, performing the tests based on the __MOODLE_XX_STABLE__ version affected and will handle any version specific caveats and run a more optimally configured test suite for you.\n\nTo view or modify the full matrix, please see it here: [.github/actions/matrix/matrix_includes.yml](.github/actions/matrix/matrix_includes.yml)\n\n## How does this automate releases?\n\nWhenever a change is made to version.php, the workflow is triggered on a release branch (e.g. __main__ / __MOODLE_XX_STABLE__), and tests pass, will it attempt to run the plugin/release action `.github/plugin/release/action.yml`. Doing so will automatically publish a release to the Moodle plugin directory at https://moodle.org/plugins.\n\nIn the prepare step of the CI, it will have resolved the component name for you so you don't need to enter one manually, and the `MOODLE_ORG_TOKEN` secret should be set otherwise the plugin won't be published.\n\nTo configure the secret:\n* Please check `MOODLE_ORG_TOKEN` is available in your plugin's **Settings \u003e Secrets** section. If not, please create using below steps:\n  * Log in to the Moodle Plugins directory at https://moodle.org/plugins/\n  * Locate the **Navigation block \u003e Plugins \u003e API access**.\n    * Use that page to generate your personal token for the `plugins_maintenance` service.\n  * Go back to your plugin repository at Github. Locate your plugin's **Settings \u003e Secrets** section. Use the 'New repository secret' button to define a new repository secret to hold your access token. Use name `MOODLE_ORG_TOKEN` and set the value to the one you generated in previous step.\n* For the latest branch/stable releases in plugin directory we **MUST** bump plugin version (e.g. by date).\n* For the __older stables__ with closed groups, the version **MUST** be a \u003cins\u003e**micro bump**\u003c/ins\u003e.\n\n## Common concerns / issues\n\n### Core patches\nIf you need to apply core patches to the moodle code to allow the plugin to work on older versions missing API support, this can be achieved by outputting\nan appliable diff to a file, in the `patch` directory in the top level of the repo. The version for a particular branch should be named `MOODLE_XX_STABLE.diff` in line with the naming of the branch. To generate a diff, these patches can be manually applied to the target branch, and a diff from the remote generated by doing `git format-patch MOODLE_XX_STABLE --stdout \u003e my/plugin/path/patch/MOODLE_XX_STABLE.diff`.\n\n### amd / grunt bundling issues\n\nDepending on your supported range, you might encounter an issue which outputs something along the lines of `File is stale and needs to be rebuilt`. The brief reason for this, is that along the way, Moodle has updated the way it bundles JS/CSS files, which results in different outputs across Moodle versions.\n\nTo fix this, you'll need to rebundle the relevant files, on the \u003cins\u003ehighest supported version of Moodle\u003c/ins\u003e for your plugin's support range. For example, if the plugin supports up to __Moodle 4.0__, you'll need to bundle the changes, while on the `MOODLE_400_STABLE` branch of Moodle, and then commit those changes.\n\n__NOTE:__ This may involve having a clean copy of Moodle and installing the plugin code to run the necessary commands to rebuild the _stale_ files.\n\nGrunt docs: https://docs.moodle.org/dev/Grunt#Running_grunt\n\n### Testing changes\nChanges can be tested by using another plugin repository that uses these workflows.\n\nSimply change the repository/branch it pulls from:\n\n```yml\nuses: catalyst/catalyst-moodle-workflows/.github/workflows/ci.yml@my-custom-branch\n```\n\nand specify the same branch as a `with` parameter:\n\n```yml\nwith:\n  internal_workflow_branch: 'my-custom-branch'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalyst%2Fcatalyst-moodle-workflows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatalyst%2Fcatalyst-moodle-workflows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalyst%2Fcatalyst-moodle-workflows/lists"}