From c6da34e33ac5b811a8a5240cd8fa1cf25580f74f Mon Sep 17 00:00:00 2001 From: Claas Augner <495429+caugner@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:08:58 +0100 Subject: [PATCH 1/2] chore(workflows): remove unused workflows (#148) * chore(workflows): remove json-lint workflow * chore(workflows): remove pr-check-redirects workflow --- .github/workflows/json-lint.yml | 38 ---------- .github/workflows/pr-check-redirects.yml | 45 ------------ README.md | 2 - docs/json-lint.md | 82 --------------------- docs/pre-check-redirect.md | 91 ------------------------ 5 files changed, 258 deletions(-) delete mode 100644 .github/workflows/json-lint.yml delete mode 100644 .github/workflows/pr-check-redirects.yml delete mode 100644 docs/json-lint.md delete mode 100644 docs/pre-check-redirect.md diff --git a/.github/workflows/json-lint.yml b/.github/workflows/json-lint.yml deleted file mode 100644 index 5bc7188..0000000 --- a/.github/workflows/json-lint.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: json-lint - -on: - workflow_call: - inputs: - target-repo: - description: The repo to run this action on. This is to prevent actions from running on forks unless intended. - required: true - type: string - node-version: - description: The node version to setup and use. - default: 18 - required: false - type: number - cache: - description: Which package manager cache to use - default: "yarn" - required: false - type: string - -jobs: - json-lint: - if: github.repository == ${{ inputs.target-repo }} - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js environment - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node-version }} - cache: ${{ inputs.cache }} - - - name: Lint JSON files - run: | - npm install --no-save eslint eslint-plugin-json - npx eslint . --ext .json diff --git a/.github/workflows/pr-check-redirects.yml b/.github/workflows/pr-check-redirects.yml deleted file mode 100644 index 78912af..0000000 --- a/.github/workflows/pr-check-redirects.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Check Redirects - -on: - workflow_call: - inputs: - target-repo: - description: The repo to run this action on. This is to prevent actions from running on forks unless intended. - required: true - type: string - cache: - description: The package manager cache to use. - default: "yarn" - required: false - type: string - node-version: - description: The node version to setup and use. - default: 18 - required: false - type: number - target-locale: - description: The target locale if required. - default: "" - required: false - type: string - -jobs: - check_redirects: - if: github.repository == inputs.target-repo - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup Node.js environment - uses: actions/setup-node@v4 - with: - node-version: ${{ inputs.node-version }} - cache: ${{ inputs.cache }} - - - name: Install all yarn packages - run: | - yarn --frozen-lockfile - - - name: Check redirects file(s) - run: yarn content validate-redirects ${{ inputs.target-locale }} --strict diff --git a/README.md b/README.md index 9472c27..9be722c 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,9 @@ Reusable GitHub Actions workflows for use in MDN repositories. - [allo-allo](.github/workflows/allo-allo.yml) ([docs](docs/allo-allo.md)) - a welcome bot for new contributors - [auto-merge](.github/workflows/auto-merge.yml) ([docs](docs/auto-merge.md)) - automatically merge pull requests - [idle](.github/workflows/idle.yml) ([docs](docs/idle.md)) - mark issues and pull requests as idle -- [json-lint](.github/workflows/json-lint.yml) ([docs](docs/json-lint.md)) - lint JSON files - [lock-closed](.github/workflows/lock-closed.yml) ([docs](docs/lock-closed.md)) - lock closed issues and pull requests - [markdown-lint](.github/workflows/markdown-lint.yml) ([docs](docs/markdown-lint.md)) - lint Markdown files - [new-issues](.github/workflows/new-issues.yml) ([docs](docs/new-issues.md)) - label new issues - [pr-rebase-needed](.github/workflows/pr-rebase-needed.yml) ([docs](docs/pr-rebase-needed.md)) - label pull requests that have merge conflicts -- [pre-check-redirect](.github/workflows/pre-check-redirect.yml) ([docs](docs/pre-check-redirect.md)) - check for redirects before merging pull requests - [publish-release](.github/workflows/publish-release.yml) ([docs](docs/publish-release.md)) - publish a release to GitHub and NPM - [set-default-labels](.github/workflows/set-default-labels.yml) ([docs](docs/set-default-labels.md)) - set default labels on new issues and pull requests diff --git a/docs/json-lint.md b/docs/json-lint.md deleted file mode 100644 index d08d463..0000000 --- a/docs/json-lint.md +++ /dev/null @@ -1,82 +0,0 @@ -# json-lint - -The `json-lint` workflow is located at [`.github/workflows/json-lint.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/json-lint.yml). - -This workflow will use [`eslint`](https://eslint.org/) to lint JSON files in the target repository. You can use the `paths` filter to only trigger this workflow for specific files or file patterns. More on this in the usage section. - -This reusable action depends on the following actions: - -- [checkout](https://github.com/marketplace/actions/checkout) -- [setup-node](https://github.com/marketplace/actions/setup-node-js-environment) - -## Inputs - -The action has the following inputs: - -### Required inputs - -#### target-repo - -Specify the target repository this action should run on. This is used to prevent actions from running on repositories other than the target repository. For example, specifying a `target-repo` of `mdn/workflows` will prevent the action from running on forks of `mdn/workflows`. - -- This `input` is required - -### Optional inputs - -#### node-version - -The node version to setup and use. - -- This `input` is optional, with a default of 16. - -#### cache - -Which package manager cache to use. - -- This `input` is optional, with a default of yarn. - -## Usage - -### With defaults - -```yml -name: json-lint - -on: - pull_request: - branches: - - main - paths: - - "*.json" - - .github/workflows/json-lint.yml - -jobs: - json-lint: - uses: mdn/workflows/.github/workflows/json-lint.yml@main - with: - target-repo: "mdn/workflows" -``` - -Above you can see how the [`paths` filter](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore) is being used to specify specific files and file patterns. - -### Overriding some defaults - -```yml -name: json-lint - -on: - pull_request: - branches: - - main - paths: - - "*.json" - - .github/workflows/json-lint.yml - -jobs: - json-lint: - uses: mdn/workflows/.github/workflows/json-lint.yml@main - with: - cache: "npm" - node-version: 18 - target-repo: "mdn/workflows" -``` diff --git a/docs/pre-check-redirect.md b/docs/pre-check-redirect.md deleted file mode 100644 index 0971cb5..0000000 --- a/docs/pre-check-redirect.md +++ /dev/null @@ -1,91 +0,0 @@ -# pre-check-redirect - -The `pr-check-redirects` reusable action is located at [`.github/workflows/pr-check-redirects.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/pr-check-redirects.yml). - -This workflow uses the Yari [`content validate-redirects`](https://github.com/mdn/content/blob/main/package.json#L13) utility to [validate the redirects file(s)](https://github.com/mdn/yari/blob/main/tool/cli.js#L68). You can use the `paths` filter to trigger this workflow only for specific files or file patterns. More on this in the usage section. - -This reusable action depends on the following actions: - -- [checkout](https://github.com/marketplace/actions/checkout) -- [setup-node](https://github.com/marketplace/actions/setup-node-js-environment) - -## Inputs - -The action has the following inputs: - -### Required inputs - -#### target-repo - -Specify the target repository this action should run on. This is used to prevent actions from running on repositories other than the target repository. For example, specifying a `target-repo` of `mdn/workflows` will prevent the action from running on forks of `mdn/workflows`. - -- This `input` is required - -### Optional inputs - -#### cache - -The package manager cache to use. - -- This `input` is optional, with the default value `yarn`. - -#### node-version - -The node version to setup and use. - -- This `input` is optional, with the default value `16`. - -#### target-locale - -The target locale for which to check the redirects file(s). - -- This `input` is optional. The default is all locales in the repository. - -## Usage - -### With defaults - -This will run for all locales in the target repository. - -```yml -name: check-redirects - -on: - pull_request: - branches: - - main - paths: - - files/** - - .github/workflows/pr-check-redirects.yml - -jobs: - check-redirects: - uses: mdn/workflows/.github/workflows/pr-check-redirects.yml@main - with: - target-repo: "mdn/workflows" -``` - -### Override some defaults - -Only run this for the `en-us` locale, using `npm` cache and Nodejs version `18`. - -```yml -name: check-redirects - -on: - pull_request: - branches: - - main - paths: - - files/** - - .github/workflows/pr-check-redirects.yml - -jobs: - check-redirects: - uses: mdn/workflows/.github/workflows/pr-check-redirects.yml@main - with: - cahce: "npm" - node-version: 18 - target-locale: "en-us" - target-repo: "mdn/workflows" -``` From ec561672e77a8b7da25c9b887d6f770ecd868b80 Mon Sep 17 00:00:00 2001 From: Claas Augner <495429+caugner@users.noreply.github.com> Date: Wed, 6 Nov 2024 13:09:17 +0100 Subject: [PATCH 2/2] chore(deps): bump node from v18 to v20 (#149) --- .github/workflows/markdown-lint.yml | 2 +- .github/workflows/publish-release.yml | 2 +- docs/markdown-lint.md | 4 ++-- docs/publish-release.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index ac452bb..66af2d1 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -9,7 +9,7 @@ on: type: string node-version: description: The node version to setup and use. - default: 18 + default: 20 required: false type: number cache: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index d4667ea..7eccf02 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -15,7 +15,7 @@ name: publish-release type: string node-version: description: The Nodejs version to use - default: 18 + default: 20 required: false type: number npm-publish: diff --git a/docs/markdown-lint.md b/docs/markdown-lint.md index ad4f683..3dfddc9 100644 --- a/docs/markdown-lint.md +++ b/docs/markdown-lint.md @@ -27,7 +27,7 @@ Specify the target repository this action should run on. This is used to prevent The node version to setup and use. -- This `input` is optional, with a default of 16. +- This `input` is optional, with a default of `20`. #### cache @@ -77,6 +77,6 @@ jobs: uses: mdn/workflows/.github/workflows/markdown-lint.yml@main with: cache: "npm" - node-version: 18 + node-version: 20 target-repo: "mdn/workflows" ``` diff --git a/docs/publish-release.md b/docs/publish-release.md index d766d24..33f257c 100644 --- a/docs/publish-release.md +++ b/docs/publish-release.md @@ -36,7 +36,7 @@ This is can be one of the release types as [detailed in the release please docs] The version of Node.js to use for the release. This action supports all [active and maintenance releases](https://nodejs.org/en/about/releases/) of Node.js. -- This `input` is optional with a default of `12` +- This `input` is optional with a default of `20` #### npm-publish