-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto update the README for new extensions added (#145)
* Auto update the README for new extensions added * Whoops, on cron only * Add the actual push part * Set to node:22 * Unique job IDs
- Loading branch information
Showing
8 changed files
with
170 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ env: | |
NODE_OPTIONS: --max_old_space_size=6144 | ||
|
||
jobs: | ||
build: | ||
check-package-json: | ||
name: Package.json | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -25,7 +25,7 @@ jobs: | |
uses: pnpm/[email protected] | ||
- name: Package | ||
run: pnpm package:json | ||
lockfile: | ||
check-package-lockfile: | ||
name: Lockfiles | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: README | ||
|
||
on: | ||
# Since we're pushing from this CI, don't run this on the push event because | ||
# that'll trigger an infinite loop | ||
# push: [ main ] | ||
|
||
# Add a schedule to run the job every day at 0:00 UTC | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
# Allow running this workflow manually | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
NODE_OPTIONS: --max_old_space_size=6144 | ||
|
||
jobs: | ||
update-readme: | ||
name: Update & PR | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
- name: Setup pnpm | ||
uses: pnpm/[email protected] | ||
- name: Install dependencies | ||
shell: bash | ||
run: pnpm install | ||
- name: Update README | ||
run: pnpm run readme | ||
- name: Commit changes | ||
run: | | ||
git config --local user.name \ | ||
"github-actions[bot]" | ||
git config --local user.email \ | ||
"41898282+github-actions[bot]@users.noreply.github.com" | ||
git add . | ||
git diff-index --quiet HEAD \ | ||
|| git commit -m "Autocommit: updated at $(date -u)" | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
force_with_lease: true |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
 | ||
|
||
--- | ||
|
||
## 🐰 Introduction | ||
|
||
This repository is for our extensions published under the Directus Labs program. Unlike the core [@directus/directus](https://github.com/directus/directus) project, extensions here may not be actively developed after their initial release unless they are indicated as maintained in the table below. | ||
|
||
## 📦 Extensions | ||
|
||
The extensions in this repository are all published to the Directus Marketplace. | ||
|
||
Some of the published extensions may not be compatible with the sandbox requirements currently, and are only available on Directus instances with the `MARKETPLACE_TRUST` env set to `all`. | ||
|
||
| Extension | Type | Sandboxed | Maintained | | ||
| --------- | --------- | --------- | ---------- | | ||
${formattedPackages.join('\n')}`; | ||
{{#extensions}} | ||
| [{{name}}](//github.com/directus-labs/extensions/tree/main/packages/{{directory}}) | {{type}} | {{sandboxed}} | {{maintained}} | | ||
{{/extensions}} | ||
|
||
## 🔧 Boilerplates | ||
|
||
| Extension | System Name | Type | | ||
| -------------------------------------------------------------------------------------------------- | :--------------------- | :-------- | | ||
| [WYSIWYG](//github.com/directus-labs/extensions/tree/main/boilerplates/input-rich-text-html) | `input-rich-text-html` | Interface | | ||
| [Block Editor](//github.com/directus-labs/extensions/tree/main/boilerplates/input-block-editor) | `input-block-editor` | Interface | | ||
| [Table](//github.com/directus-labs/extensions/tree/main/boilerplates/tabular-layout) | `tabular` | Layout | | ||
|
||
<br> | ||
|
||
## ❤️ Contributing | ||
|
||
Please read the [Contributing Guide](//github.com/directus-labs/extensions/blob/main/.github/CONTRIBUTING.md) for this project before submitting Pull Requests or Issues. | ||
|
||
All security vulnerabilities should be reported in accordance with our [Security Policy](//docs.directus.io/contributing/introduction.html#report-security-vulnerability). | ||
|
||
Directus is a premium open-source ([BSL 1.1](//github.com/directus/directus/blob/main/license)) project, made possible with support from our passionate core team, talented contributors, and amazing [GitHub Sponsors](//github.com/sponsors/directus). Thank you all!! | ||
|
||
© 2004-2024, Monospace, Inc. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const fs = require('node:fs'); | ||
const { formatTitle } = require('@directus/format-title'); | ||
const Mustache = require('mustache'); | ||
|
||
const metaData = JSON.parse(fs.readFileSync(`./package.json`))['directus:meta']; | ||
|
||
/* Update the packages */ | ||
const packages = fs.readdirSync('./packages'); | ||
|
||
function removePrefix(name) { | ||
if (name.startsWith('@')) { | ||
name = name.split('/')[1]; | ||
} | ||
|
||
if (name.startsWith('directus-extension-')) { | ||
name = name.substring('directus-extension-'.length); | ||
} | ||
|
||
return name; | ||
} | ||
|
||
const formattedPackages = packages.map((packageDir) => { | ||
const packageJson = JSON.parse(fs.readFileSync(`./packages/${packageDir}/package.json`)); | ||
return { | ||
name: formatTitle(removePrefix(packageJson.name)), | ||
type: formatTitle(packageJson['directus:extension'].type), | ||
sandboxed: (packageJson['directus:extension'].sandbox ? '✅' : 'N/A'), | ||
maintained: (metaData.maintained.includes(packageDir) ? '⭐' : ''), | ||
directory: packageDir, | ||
}; | ||
}); | ||
|
||
const readmeTemplate = fs.readFileSync('scripts/templates/readme.md. mustache').toString(); | ||
const readmeOutput = Mustache.render(readmeTemplate, { extensions: formattedPackages }); | ||
|
||
fs.writeFileSync('./readme.md', readmeOutput); |