├── .editorconfig ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug.yml │ └── config.yml ├── PULL_REQUEST_TEMPLATE ├── dependabot.yml └── workflows │ ├── auto-merge-workflows.yml │ ├── auto-merge.yml │ ├── idle.yml │ ├── lock-closed.yml │ ├── markdown-lint.yml │ ├── new-issues.yml │ ├── pr-rebase-needed.yml │ ├── publish-release.yml │ └── set-default-labels.yml ├── .gitignore ├── .prettierrc.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── REVIEWING.md └── docs ├── auto-merge.md ├── idle.md ├── lock-closed.md ├── markdown-lint.md ├── new-issues.md ├── pr-rebase-needed.md ├── publish-release.md └── set-default-labels.md /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | indent_style = space 8 | indent_size = 2 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # This file is used to add reviewers to PRs. 2 | 3 | # Default 4 | * @mdn/core-yari-content @mdn/core-dev 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug.yml: -------------------------------------------------------------------------------- 1 | name: "Issue report" 2 | description: Report an unexpected problem or unintended behavior. 3 | labels: ["needs triage"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | ### Before you start 9 | 10 | **Want to fix the problem yourself?** This project is open source and we welcome fixes and improvements from the community! 11 | 12 | ↩ Check the project [CONTRIBUTING.md](../blob/main/CONTRIBUTING.md) guide to see how to get started. 13 | 14 | --- 15 | - type: textarea 16 | id: problem 17 | attributes: 18 | label: What information was incorrect, unhelpful, or incomplete? 19 | validations: 20 | required: true 21 | - type: textarea 22 | id: expected 23 | attributes: 24 | label: What did you expect to see? 25 | validations: 26 | required: true 27 | - type: textarea 28 | id: references 29 | attributes: 30 | label: Do you have any supporting links, references, or citations? 31 | description: Link to information that helps us confirm your issue. 32 | - type: textarea 33 | id: more-info 34 | attributes: 35 | label: Do you have anything more you want to share? 36 | description: For example, steps to reproduce, screenshots, screen recordings, or sample code. 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Content or feature request 4 | url: https://github.com/mdn/mdn/issues/new/choose 5 | about: Propose new content for MDN Web Docs or submit a feature request using this link. 6 | - name: MDN GitHub Discussions 7 | url: https://github.com/orgs/mdn/discussions 8 | about: Does the issue involve a lot of changes, or is it hard to split it into actionable tasks? Start a discussion before opening an issue. 9 | - name: MDN Web Docs on Discourse 10 | url: https://discourse.mozilla.org/c/mdn/learn/250 11 | about: Need help with assessments on MDN Web Docs? We have a support community for this purpose on Discourse. 12 | - name: Help with code 13 | url: https://stackoverflow.com/ 14 | about: If you are stuck and need help with code, StackOverflow is a great resource. 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Description 4 | 5 | 6 | 7 | ### Motivation 8 | 9 | 10 | 11 | ### Additional details 12 | 13 | 14 | 15 | ### Related issues and pull requests 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "npm" 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "11:00" 8 | open-pull-requests-limit: 20 9 | - package-ecosystem: github-actions 10 | directory: "/" 11 | schedule: 12 | interval: daily 13 | time: "11:00" 14 | open-pull-requests-limit: 20 15 | -------------------------------------------------------------------------------- /.github/workflows/auto-merge-workflows.yml: -------------------------------------------------------------------------------- 1 | name: "auto-merge" 2 | on: [pull_request_target] 3 | 4 | permissions: 5 | # Approve and comment pull request. 6 | pull-requests: write 7 | 8 | jobs: 9 | auto-merge: 10 | uses: mdn/workflows/.github/workflows/auto-merge.yml@main 11 | with: 12 | target-repo: "mdn/workflows" 13 | secrets: 14 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 15 | -------------------------------------------------------------------------------- /.github/workflows/auto-merge.yml: -------------------------------------------------------------------------------- 1 | name: auto-merge 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | auto-approve: 7 | description: Automatically approve pull-requests 8 | default: true 9 | required: false 10 | type: boolean 11 | command: 12 | description: The command to pass to Dependabot 13 | default: "squash and merge" 14 | required: false 15 | type: string 16 | target: 17 | description: The version comparison target (major, minor, patch) 18 | default: minor 19 | required: false 20 | type: string 21 | target-repo: 22 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 23 | required: true 24 | type: string 25 | secrets: 26 | GH_TOKEN: 27 | description: "Personal access token passed from the caller workflow" 28 | required: true 29 | 30 | jobs: 31 | auto-merge: 32 | if: github.repository == inputs.target-repo && github.event.pull_request.user.login == 'dependabot[bot]' 33 | runs-on: ubuntu-latest 34 | steps: 35 | - uses: actions/checkout@v4 36 | - uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2.6.6 37 | with: 38 | approve: ${{ inputs.auto-approve }} 39 | command: ${{ inputs.command }} 40 | target: ${{ inputs.target }} 41 | github-token: ${{ secrets.GH_TOKEN }} 42 | -------------------------------------------------------------------------------- /.github/workflows/idle.yml: -------------------------------------------------------------------------------- 1 | name: 'Mark issues and pull requests as idle' 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | target-repo: 7 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 8 | required: true 9 | type: string 10 | days-before-close: 11 | description: The idle number of days before closing the stale issues or the stale pull requests. 12 | default: -1 13 | required: false 14 | type: number 15 | label: 16 | description: The label to apply when the issue/PR is idle 17 | default: "idle" 18 | required: false 19 | type: string 20 | stale-days: 21 | description: How many days before the issue/PR is considered idle 22 | default: 30 23 | required: false 24 | type: number 25 | close-issue-message: 26 | description: Comment to add when a stale issue is closed. 27 | required: false 28 | type: string 29 | stale-issue-message: 30 | description: Comment to add when an issue becomes stale. 31 | required: false 32 | type: string 33 | close-pr-message: 34 | description: Comment to add when a stale PR is closed. 35 | required: false 36 | type: string 37 | stale-pr-message: 38 | description: Comment to add when a PR becomes stale. 39 | required: false 40 | type: string 41 | 42 | jobs: 43 | idle: 44 | if: github.repository == inputs.target-repo 45 | runs-on: ubuntu-latest 46 | steps: 47 | - uses: actions/stale@v9 48 | with: 49 | days-before-stale: ${{ inputs.stale-days }} 50 | days-before-close: ${{ inputs.days-before-close }} 51 | stale-issue-label: ${{ inputs.label }} 52 | stale-pr-label: ${{ inputs.label }} 53 | close-issue-message: ${{ inputs.close-issue-message }} 54 | stale-issue-message: ${{ inputs.stale-issue-message }} 55 | close-pr-message: ${{ inputs.close-pr-message }} 56 | stale-pr-message: ${{ inputs.stale-pr-message }} 57 | enable-statistics: true 58 | ascending: true # oldest first, for now 59 | operations-per-run: 300 60 | -------------------------------------------------------------------------------- /.github/workflows/lock-closed.yml: -------------------------------------------------------------------------------- 1 | name: 'Lock old issues and pull requests' 2 | on: 3 | workflow_call: 4 | inputs: 5 | target-repo: 6 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 7 | required: true 8 | type: string 9 | issue-inactive-days: 10 | description: The number of days before an issue is considered inactive. 11 | default: "365" 12 | required: false 13 | type: string 14 | 15 | permissions: 16 | issues: write 17 | pull-requests: write 18 | 19 | concurrency: 20 | group: lock 21 | 22 | jobs: 23 | lock-closed: 24 | if: github.repository == inputs.target-repo 25 | runs-on: ubuntu-latest 26 | steps: 27 | - uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1 28 | with: 29 | issue-inactive-days: ${{ inputs.issue-inactive-days }} 30 | -------------------------------------------------------------------------------- /.github/workflows/markdown-lint.yml: -------------------------------------------------------------------------------- 1 | name: markdown-lint 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | target-repo: 7 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 8 | required: true 9 | type: string 10 | node-version: 11 | description: The node version to setup and use. 12 | default: 20 13 | required: false 14 | type: number 15 | cache: 16 | description: Which package manager cache to use 17 | default: "yarn" 18 | required: false 19 | type: string 20 | 21 | jobs: 22 | markdown-lint: 23 | if: github.repository == inputs.target-repo 24 | runs-on: ubuntu-latest 25 | 26 | steps: 27 | - uses: actions/checkout@v4 28 | 29 | - name: Setup Node.js environment 30 | uses: actions/setup-node@v4 31 | with: 32 | node-version: ${{ inputs.node-version }} 33 | cache: ${{ inputs.cache }} 34 | 35 | - name: Lint Markdown files 36 | run: | 37 | npx markdownlint-cli '*.md' -i LICENSE.md -i CODE_OF_CONDUCT.md 38 | -------------------------------------------------------------------------------- /.github/workflows/new-issues.yml: -------------------------------------------------------------------------------- 1 | name: "Mark new issues with specified label(s)" 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | target-repo: 7 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 8 | required: true 9 | type: string 10 | add-labels: 11 | description: Labels to add as a comma separated list. 12 | default: "needs triage" 13 | required: false 14 | type: string 15 | 16 | jobs: 17 | label-new-issues: 18 | if: github.repository == inputs.target-repo 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: initial labelling 22 | uses: andymckay/labeler@e6c4322d0397f3240f0e7e30a33b5c5df2d39e90 # v1.0.4 23 | with: 24 | add-labels: ${{ inputs.add-labels }} 25 | -------------------------------------------------------------------------------- /.github/workflows/pr-rebase-needed.yml: -------------------------------------------------------------------------------- 1 | name: "PR merge conflicts" 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | target-repo: 7 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 8 | required: true 9 | type: string 10 | label: 11 | description: The label to apply when a rebase is needed 12 | default: "merge conflicts :construction:" 13 | required: false 14 | type: string 15 | comment: 16 | description: The comment to write when a rebase is needed 17 | default: "This pull request has merge conflicts that must be resolved before it can be merged." 18 | required: false 19 | type: string 20 | secrets: 21 | GH_TOKEN: 22 | description: "Personal access token passed from the caller workflow" 23 | required: true 24 | 25 | jobs: 26 | label-rebase-needed: 27 | if: github.repository == inputs.target-repo 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Check for merge conflicts 31 | uses: eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0 # v3.0.3 32 | with: 33 | dirtyLabel: ${{ inputs.label }} 34 | repoToken: "${{ secrets.GH_TOKEN }}" 35 | commentOnDirty: ${{ inputs.comment }} 36 | -------------------------------------------------------------------------------- /.github/workflows/publish-release.yml: -------------------------------------------------------------------------------- 1 | name: publish-release 2 | "on": 3 | workflow_call: 4 | inputs: 5 | target-repo: 6 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 7 | required: true 8 | type: string 9 | release-type: 10 | description: >- 11 | The type of release to publish. See 12 | https://github.com/googleapis/release-please#release-types-supported 13 | default: node 14 | required: false 15 | type: string 16 | node-version: 17 | description: The Nodejs version to use 18 | default: 20 19 | required: false 20 | type: number 21 | npm-publish: 22 | description: Whether to publish the package to npm 23 | default: true 24 | required: false 25 | type: boolean 26 | npm-publish-args: 27 | description: >- 28 | Arguments passed to `npm publish` command; ignored if "npm-publish" is 29 | false 30 | default: "" 31 | required: false 32 | type: string 33 | registry-url: 34 | description: The registry to publish to 35 | default: "https://registry.npmjs.org" 36 | required: false 37 | type: string 38 | secrets: 39 | GH_TOKEN: 40 | description: Personal access token passed from the caller workflow 41 | required: true 42 | NPM_AUTH_TOKEN: 43 | description: Your NPM registry token 44 | required: false 45 | jobs: 46 | release-please: 47 | if: github.repository == inputs.target-repo 48 | runs-on: ubuntu-latest 49 | steps: 50 | - uses: GoogleCloudPlatform/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3 51 | id: release 52 | with: 53 | token: "${{ secrets.GH_TOKEN }}" 54 | release-type: "${{ inputs.release-type }}" 55 | - uses: actions/checkout@v4 56 | if: inputs.npm-publish && steps.release.outputs.release_created 57 | - uses: actions/setup-node@v4 58 | with: 59 | node-version: "${{ inputs.node-version }}" 60 | registry-url: "${{ inputs.registry-url }}" 61 | if: inputs.npm-publish && steps.release.outputs.release_created 62 | - run: npm ci 63 | if: inputs.npm-publish && steps.release.outputs.release_created 64 | - run: "npm publish ${{ inputs.npm-publish-args }}" 65 | env: 66 | NODE_AUTH_TOKEN: "${{secrets.NPM_AUTH_TOKEN}}" 67 | if: inputs.npm-publish && steps.release.outputs.release_created 68 | -------------------------------------------------------------------------------- /.github/workflows/set-default-labels.yml: -------------------------------------------------------------------------------- 1 | name: set-default-labels 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | target-repo: 7 | description: The repo to run this action on. This is to prevent actions from running on forks unless intended. 8 | required: true 9 | type: string 10 | should-delete-labels: 11 | description: 'Delete labels that are not in the list' 12 | default: false 13 | required: false 14 | type: boolean 15 | 16 | jobs: 17 | set-default-labels: 18 | if: github.repository == inputs.target-repo 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v4 22 | - uses: lannonbr/issue-label-manager-action@e8dbcd8198e86a1e98d5372e55db976fed9ba6f7 # v4.0.0 23 | env: 24 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 25 | with: 26 | delete: ${{ inputs.should-delete-labels }} 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | .env 73 | .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | #VSCode settings 107 | .vscode 108 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of conduct 2 | 3 | This repository is governed by Mozilla's code of conduct and etiquette guidelines. 4 | For more details, read [Mozilla's Community Participation Guidelines](https://www.mozilla.org/about/governance/policies/participation/). 5 | 6 | ## Reporting violations 7 | 8 | For more information on how to report violations of the Community Participation Guidelines, read the [How to report](https://www.mozilla.org/about/governance/policies/participation/reporting/) page. 9 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribution guide 2 | 3 | ![github-profile](https://user-images.githubusercontent.com/10350960/166113119-629295f6-c282-42c9-9379-af2de5ad4338.png) 4 | 5 | - [Ways to contribute](#ways-to-contribute) 6 | - [Finding an issue](#finding-an-issue) 7 | - [Asking for help](#asking-for-help) 8 | - [Pull request process](#pull-request-process) 9 | - [Forking and cloning the project](#forking-and-cloning-the-project) 10 | - [Signing commits](#signing-commits) 11 | 12 | Welcome 👋 Thank you for your interest in contributing to MDN Web Docs. We are happy to have you join us! 💖 13 | 14 | As you get started, you are in the best position to give us feedback on project areas we might have forgotten about or assumed to work well. 15 | These include, but are not limited to: 16 | 17 | - Problems found while setting up a new developer environment 18 | - Gaps in our documentation 19 | - Bugs in our automation scripts 20 | 21 | If anything doesn't make sense or work as expected, please open an issue and let us know! 22 | 23 | ## Ways to contribute 24 | 25 | We welcome many different types of contributions including: 26 | 27 | - New features and content suggestions. 28 | - Identifying and filing issues. 29 | - Providing feedback on existing issues. 30 | - Engaging with the community and answering questions. 31 | - Contributing documentation or code. 32 | - Promoting the project in personal circles and social media. 33 | 34 | ## Finding an issue 35 | 36 | We have issues labeled `good first issue` for new contributors and `help wanted` suitable for any contributor. 37 | Good first issues have extra information to help you make your first contribution a success. 38 | Help wanted issues are ideal when you feel a bit more comfortable with the project details. 39 | 40 | Sometimes there won't be any issues with these labels, but there is likely still something for you to work on. 41 | If you want to contribute but don't know where to start or can't find a suitable issue, speak to us on [Matrix](https://matrix.to/#/#mdn:mozilla.org), and we will be happy to help. 42 | 43 | Once you find an issue you'd like to work on, please post a comment saying you want to work on it. 44 | Something like "I want to work on this" is fine. 45 | Also, mention the community team using the `@mdn/mdn-community-engagement` handle to ensure someone will get back to you. 46 | 47 | ## Asking for help 48 | 49 | The best way to reach us with a question when contributing is to use the following channels in the following order of precedence: 50 | 51 | - [Start a discussion](https://github.com/orgs/mdn/discussions) 52 | - Ask your question or highlight your discussion on [Matrix](https://matrix.to/#/#mdn:mozilla.org). 53 | - File an issue and tag the community team using the `@mdn/mdn-community-engagement` handle. 54 | 55 | ## Pull request process 56 | 57 | The MDN Web Docs project has a well-defined pull request process which is documented in the [Pull request guidelines](https://developer.mozilla.org/en-US/docs/MDN/Community/Pull_requests). 58 | Make sure you read and understand this process before you start working on a pull request. 59 | 60 | ### Forking and cloning the project 61 | 62 | The first step in setting up your development environment is to [fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) and [clone](https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository) the repository to your local machine. 63 | 64 | ## Signing commits 65 | 66 | We require all commits to be signed to verify the author's identity. 67 | GitHub has a detailed guide on [setting up signed commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits). 68 | If you get stuck, please [ask for help](#asking-for-help). 69 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # workflows 2 | 3 | Reusable GitHub Actions workflows for use in MDN repositories. 4 | 5 | ## Available actions 6 | 7 | - [auto-merge](.github/workflows/auto-merge.yml) ([docs](docs/auto-merge.md)) - automatically merge pull requests 8 | - [idle](.github/workflows/idle.yml) ([docs](docs/idle.md)) - mark issues and pull requests as idle 9 | - [lock-closed](.github/workflows/lock-closed.yml) ([docs](docs/lock-closed.md)) - lock closed issues and pull requests 10 | - [markdown-lint](.github/workflows/markdown-lint.yml) ([docs](docs/markdown-lint.md)) - lint Markdown files 11 | - [new-issues](.github/workflows/new-issues.yml) ([docs](docs/new-issues.md)) - label new issues 12 | - [pr-rebase-needed](.github/workflows/pr-rebase-needed.yml) ([docs](docs/pr-rebase-needed.md)) - label pull requests that have merge conflicts 13 | - [publish-release](.github/workflows/publish-release.yml) ([docs](docs/publish-release.md)) - publish a release to GitHub and NPM 14 | - [set-default-labels](.github/workflows/set-default-labels.yml) ([docs](docs/set-default-labels.md)) - set default labels on new issues and pull requests 15 | -------------------------------------------------------------------------------- /REVIEWING.md: -------------------------------------------------------------------------------- 1 | # Reviewing guide 2 | 3 | All reviewers must abide by the [code of conduct](CODE_OF_CONDUCT.md); they are also protected by the code of conduct. 4 | A reviewer should not tolerate poor behavior and is encouraged to [report any behavior](CODE_OF_CONDUCT.md#Reporting_violations) that violates the code of conduct. 5 | 6 | ## Review process 7 | 8 | The MDN Web Docs team has a well-defined review process that must be followed by reviewers in all repositories under the GitHub MDN organization. 9 | This process is described in detail on the [Pull request guidelines](https://developer.mozilla.org/en-US/docs/MDN/Community/Pull_requests) page. 10 | -------------------------------------------------------------------------------- /docs/auto-merge.md: -------------------------------------------------------------------------------- 1 | # auto-merge 2 | 3 | The `auto-merge` reusable action is located at [`.github/actions/auto-merge.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/auto-merge.yml). 4 | 5 | This workflow auto merges pull requests. 6 | To use it you will need a [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the following scopes: 7 | 8 | - `repo` for private repositories 9 | - `public_repo` for public repositories 10 | 11 | > NOTE: This action will auto merge only those pull requests that were opened by [Dependabot](https://github.com/dependabot). 12 | 13 | In the repository that will call this action, you need to [define a secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) named `GH_TOKEN` with the value of your Personal Access Token. 14 | 15 | This reusable action depends on the following actions: 16 | 17 | - [checkout](https://github.com/marketplace/actions/checkout) 18 | - [dependabot-auto-merge](https://github.com/marketplace/actions/dependabot-auto-merge) 19 | 20 | ## Inputs 21 | 22 | ### Required inputs 23 | 24 | #### target-repo 25 | 26 | 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 workflow from running on forks of `mdn/workflows`. 27 | 28 | - This `input` is required 29 | 30 | ### Optional inputs 31 | 32 | The action has the following optional inputs: 33 | 34 | #### auto-approve 35 | 36 | Automatically approve pull-requests. 37 | 38 | - This `input` is optional with a default of `true`. 39 | 40 | #### command 41 | 42 | The command to pass to Dependabot. 43 | 44 | - This `input` is optional with a default of `squash and merge`. 45 | 46 | #### target 47 | 48 | The version comparison target. One off major, minor, or patch. 49 | 50 | - This `input` is optional with a default of `minor`. 51 | 52 | ## Usage 53 | 54 | In the repository that will call this action, you will need to add a `.github/workflows/auto-merge.yml` file with the following content: 55 | 56 | ### With defaults 57 | 58 | ```yml 59 | name: "auto-merge" 60 | on: [pull_request_target] 61 | 62 | jobs: 63 | auto-merge: 64 | uses: mdn/workflows/.github/workflows/auto-merge.yml@main 65 | with: 66 | target-repo: "mdn/workflows" 67 | secrets: 68 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 69 | ``` 70 | 71 | ### Overriding some defaults 72 | 73 | ```yml 74 | name: "auto-merge" 75 | on: [pull_request_target] 76 | 77 | jobs: 78 | auto-merge: 79 | uses: mdn/workflows/.github/workflows/auto-merge.yml@main 80 | with: 81 | auto-approve: false 82 | target-repo: "mdn/workflows" 83 | secrets: 84 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 85 | ``` 86 | -------------------------------------------------------------------------------- /docs/idle.md: -------------------------------------------------------------------------------- 1 | # idle 2 | 3 | The `idle` reusable action is located at [`.github/workflows/idle.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/idle.yml). 4 | 5 | > **NOTE:** We currently use this action to label issues only. We do not automatically close issues or pull requests using this action. 6 | 7 | This reusable action depends on the following actions: 8 | 9 | - [stale](https://github.com/marketplace/actions/close-stale-issues) 10 | 11 | ## Inputs 12 | 13 | ### Required inputs 14 | 15 | #### target-repo 16 | 17 | 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`. 18 | 19 | - This `input` is required. 20 | 21 | ### Optional inputs 22 | 23 | #### days-before-close 24 | 25 | If set to a non-negative number, issues and pull requests with the idle label will automatically be closed after the set number of days. 26 | 27 | - This `input` is optional with a default of -1 28 | 29 | #### label 30 | 31 | If your repository uses a label named anything other than `idle` (for example, the repository may want to use use `stale`), you can set the label here. 32 | 33 | - This `input` is optional with a default of `idle` 34 | 35 | #### stale-days 36 | 37 | The number of days before the issue or pull request is considered idle and the label and/or comment is applied. 38 | 39 | - This `input` is optional with a default of 30 40 | 41 | ## Usage 42 | 43 | In the repository that will call this action, you will need to add a `.github/workflows/mark-as-idle.yml` file with the following content: 44 | 45 | ### With defaults 46 | 47 | ```yml 48 | name: "Label Idle Issues" 49 | 50 | on: 51 | push: 52 | pull_request_target: 53 | types: [synchronize] 54 | 55 | jobs: 56 | mark-as-idle: 57 | uses: mdn/workflows/.github/workflows/mark-as-idle.yml@main 58 | with: 59 | target-repo: "mdn/workflows" 60 | ``` 61 | 62 | ### Overriding some defaults 63 | 64 | ```yml 65 | name: "Label Idle Issues" 66 | 67 | on: 68 | push: 69 | pull_request_target: 70 | types: [synchronize] 71 | 72 | jobs: 73 | mark-as-idle: 74 | uses: mdn/workflows/.github/workflows/mark-as-idle.yml@main 75 | with: 76 | label: "stale" 77 | target-repo: ${{ input.target_repo }} 78 | ``` 79 | -------------------------------------------------------------------------------- /docs/lock-closed.md: -------------------------------------------------------------------------------- 1 | # lock-closed 2 | 3 | The `lock-closed` workflow is located at [`.github/workflows/lock-closed.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/lock-closed.yml). 4 | 5 | The `lock-closed` GitHub Action automatically locks issues and PRs that have been closed for more than a year. 6 | It is intended to reduce "necrobumping" (the addition of comments, including spam, to old/closed issues). 7 | 8 | This reusable action depends on the following actions: 9 | 10 | - [dessant/lock-threads@v3](https://github.com/dessant/lock-threads) 11 | 12 | ## Inputs 13 | 14 | The action has the following inputs: 15 | 16 | ### Required inputs 17 | 18 | #### target-repo 19 | 20 | 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`. 21 | 22 | - This `input` is required. 23 | 24 | ### Optional inputs 25 | 26 | #### issue-inactive-days 27 | 28 | The number of days before an issue is considered inactive. 29 | 30 | - This `input` is optional with a default of 365 31 | 32 | ## Usage 33 | 34 | In the repository that will call this action, you will need to add a `.github/workflows/lock-closed.yml` file with the following content: 35 | 36 | ### With defaults 37 | 38 | ```yml 39 | name: "Lock inactive issues and pull requests" 40 | 41 | on: 42 | schedule: 43 | - cron: "0 * * * *" 44 | workflow_dispatch: 45 | 46 | jobs: 47 | lock-closed: 48 | uses: mdn/workflows/.github/workflows/lock-closed.yml@main 49 | with: 50 | target-repo: "mdn/workflows" 51 | ``` 52 | 53 | ### Overriding default inactive days 54 | 55 | ```yml 56 | name: "Lock inactive issues and pull requests" 57 | 58 | on: 59 | schedule: 60 | - cron: "0 * * * *" 61 | workflow_dispatch: 62 | 63 | jobs: 64 | lock-closed: 65 | uses: mdn/workflows/.github/workflows/lock-closed.yml@main 66 | with: 67 | issue-inactive-days: 42 68 | target-repo: "mdn/workflows" 69 | ``` 70 | -------------------------------------------------------------------------------- /docs/markdown-lint.md: -------------------------------------------------------------------------------- 1 | # markdown-lint 2 | 3 | The `markdown-lint` reusable action is located at [`.github/workflows/markdown-lint.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/markdown-lint.yml). 4 | 5 | This workflow will use the [`markdownlint-cli`](https://github.com/igorshubovych/markdownlint-cli) to lint markdown 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. 6 | 7 | This reusable action depends on the following actions: 8 | 9 | - [checkout](https://github.com/marketplace/actions/checkout) 10 | - [setup-node](https://github.com/marketplace/actions/setup-node-js-environment) 11 | 12 | ## Inputs 13 | 14 | The action has the following inputs: 15 | 16 | ### Required inputs 17 | 18 | #### target-repo 19 | 20 | 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`. 21 | 22 | - This `input` is required 23 | 24 | ### Optional inputs 25 | 26 | #### node-version 27 | 28 | The node version to setup and use. 29 | 30 | - This `input` is optional, with a default of `20`. 31 | 32 | #### cache 33 | 34 | Which package manager cache to use. 35 | 36 | - This `input` is optional, with a default of yarn. 37 | 38 | ## Usage 39 | 40 | ### With defaults 41 | 42 | ```yml 43 | name: markdown-lint 44 | 45 | on: 46 | pull_request: 47 | branches: 48 | - main 49 | paths: 50 | - "*.md" 51 | - .github/workflows/markdown-lint.yml 52 | 53 | jobs: 54 | markdown-lint: 55 | uses: mdn/workflows/.github/workflows/markdown-lint.yml@main 56 | with: 57 | target-repo: "mdn/workflows" 58 | ``` 59 | 60 | 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. 61 | 62 | ### Overriding some defaults 63 | 64 | ```yml 65 | name: markdown-lint 66 | 67 | on: 68 | pull_request: 69 | branches: 70 | - main 71 | paths: 72 | - "*.md" 73 | - .github/workflows/markdown-lint.yml 74 | 75 | jobs: 76 | markdown-lint: 77 | uses: mdn/workflows/.github/workflows/markdown-lint.yml@main 78 | with: 79 | cache: "npm" 80 | node-version: 20 81 | target-repo: "mdn/workflows" 82 | ``` 83 | -------------------------------------------------------------------------------- /docs/new-issues.md: -------------------------------------------------------------------------------- 1 | # new-issues 2 | 3 | The `new-issues` reusable action is located at [`.github/workflows/new-issues.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/new-issues.yml). 4 | 5 | This reusable action depends on the following actions: 6 | 7 | - [andymckay/labeler](https://github.com/marketplace/actions/simple-issue-labeler) 8 | 9 | ## Inputs 10 | 11 | The action has the following inputs: 12 | 13 | ### Required inputs 14 | 15 | #### target-repo 16 | 17 | 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`. 18 | 19 | - This `input` is required. 20 | 21 | ### Optional inputs 22 | 23 | The action has the following inputs: 24 | 25 | #### add-labels 26 | 27 | Labels to add as a comma separated list. 28 | 29 | - This `input` is optional with a default of `needs-triage`. 30 | 31 | ## Usage 32 | 33 | In the repository that will call this action, you will need to add a `.github/workflows/new-issues.yml` file with the following content: 34 | 35 | ### With defaults 36 | 37 | ```yml 38 | name: "Mark new issues with specified label(s)" 39 | 40 | on: 41 | issues: 42 | types: 43 | - reopened 44 | - opened 45 | 46 | jobs: 47 | label-new-issues: 48 | uses: mdn/workflows/.github/workflows/new-issues.yml@main 49 | with: 50 | target-repo: "mdn/workflows" 51 | ``` 52 | 53 | ### Overriding some defaults 54 | 55 | ```yml 56 | name: "Mark new issues with specified label(s)" 57 | 58 | on: 59 | issues: 60 | types: 61 | - reopened 62 | - opened 63 | 64 | jobs: 65 | label-new-issues: 66 | uses: mdn/workflows/.github/workflows/new-issues.yml@main 67 | with: 68 | add-labels: "triage, bug" 69 | target-repo: "mdn/workflows" 70 | ``` 71 | -------------------------------------------------------------------------------- /docs/pr-rebase-needed.md: -------------------------------------------------------------------------------- 1 | # pr-rebase-needed 2 | 3 | The `pr-rebase-needed` reusable action is located at [`.github/workflows/pr-rebase-needed.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/pr-rebase-needed.yml). 4 | 5 | This reusable action depends on the following actions: 6 | 7 | - [actions-label-merge-conflict](https://github.com/marketplace/actions/label-conflicting-pull-requests) 8 | 9 | ## Inputs 10 | 11 | The action has the following inputs: 12 | 13 | ### Required inputs 14 | 15 | #### target-repo 16 | 17 | 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`. 18 | 19 | - This `input` is required. 20 | 21 | ### Optional inputs 22 | 23 | #### label 24 | 25 | If your repository uses a label named anything other than `rebase needed 🚧` (for example, the repository may use `merge conflicts`), you can set the label here. 26 | 27 | - This `input` is optional with a default of `rebase needed :construction:` 28 | 29 | #### comment 30 | 31 | When a rebase is needed, the action will write a comment on the pull request to let the PR author know there are merge conflicts. This can be changed to whatever the repository desires, or left blank if no comment should be added. 32 | 33 | - This `input` is optional with a default of `This pull request has merge conflicts that must be resolved before it can be merged.` 34 | 35 | ### Secrets 36 | 37 | This action requires the following secrets to be passed by the caller. These need to be set as [environmental secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) using the calling repositories settings. 38 | 39 | #### GH_TOKEN 40 | 41 | Personal access token passed from the caller workflow. Read the documentation on [creating a PA token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). 42 | 43 | ## Usage 44 | 45 | In the repository that will call this action, you will need to add a `.github/workflows/pr-rebase-needed.yml` file with the following content: 46 | 47 | ### With defaults 48 | 49 | ```yml 50 | name: pr-rebase-needed 51 | 52 | on: 53 | push: 54 | pull_request_target: 55 | types: [synchronize] 56 | 57 | jobs: 58 | pr-rebase-needed: 59 | uses: mdn/workflows/.github/workflows/pr-rebase-needed.yml@main 60 | with: 61 | target-repo: "mdn/workflows" 62 | secrets: 63 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 64 | ``` 65 | 66 | ### Overriding some defaults 67 | 68 | ```yml 69 | name: pr-rebase-needed 70 | 71 | on: 72 | push: 73 | pull_request_target: 74 | types: [synchronize] 75 | 76 | jobs: 77 | pr-rebase-needed: 78 | uses: mdn/workflows/.github/workflows/pr-rebase-needed.yml@main 79 | with: 80 | comment: "This pull requests has merge conflicts that needs to be resolved before being merged. Thank you." 81 | target-repo: "mdn/workflows" 82 | secrets: 83 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 84 | ``` 85 | -------------------------------------------------------------------------------- /docs/publish-release.md: -------------------------------------------------------------------------------- 1 | # publish-release 2 | 3 | The `publish-release` reusable action is located at [`.github/workflows/publish-release.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/publish-release.yml). 4 | 5 | The `publish-release` GitHub Action automates publication of a new release on GitHub, updates the changelog and also publishes to the NPM registry. 6 | 7 | > NOTE: For the `release-please` workflow to work effectively, you need to follow the conventional commits conventions as [detailed here](https://www.conventionalcommits.org). You can also find additional documentation on the [GitHub Actions README](https://github.com/googleapis/release-please#how-should-i-write-my-commits). 8 | 9 | This reusable action depends on the following actions: 10 | 11 | - [GoogleCloudPlatform/release-please-action](https://github.com/googleapis/release-please) 12 | - [checkout](https://github.com/marketplace/actions/checkout) 13 | - [actions/setup-node](https://github.com/actions/setup-node) 14 | 15 | ## Inputs 16 | 17 | The action has the following inputs: 18 | 19 | ### Required inputs 20 | 21 | #### target-repo 22 | 23 | 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`. 24 | 25 | - This `input` is required. 26 | 27 | ### Optional inputs 28 | 29 | #### release-type 30 | 31 | This is can be one of the release types as [detailed in the release please docs](https://github.com/googleapis/release-please#release-types-supported). 32 | 33 | - This `input` is optional with a default of `node` 34 | 35 | #### node-version 36 | 37 | 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. 38 | 39 | - This `input` is optional with a default of `20` 40 | 41 | #### npm-publish 42 | 43 | Whether to publish the package to the NPM registry. 44 | 45 | - This `input` is optional with a default of `true` 46 | 47 | #### npm-publish-args 48 | 49 | Arguments to pass to the `npm publish` command. This is ignored if `npm-publish` is set to `false`. 50 | 51 | - This `input` is optional with a default of an empty string 52 | 53 | #### registry-url 54 | 55 | The registry to publish to. 56 | 57 | - This `input` is optional with a default of `https://registry.npmjs.org` 58 | 59 | ## Secrets 60 | 61 | This action requires the following secrets to be passed by the caller. Both of these need to be set as [environmental secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) using the calling repositories settings. 62 | 63 | ### GH_TOKEN 64 | 65 | Personal access token passed from the caller workflow. Read the documentation on [creating a PA token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token). 66 | 67 | ### NPM_AUTH_TOKEN 68 | 69 | Authentication token for the NPM registry. Read the documentation for details on [creating a token](https://docs.npmjs.com/creating-and-viewing-access-tokens). 70 | 71 | > NOTE: When skipping NPM publishing, this token is not required. 72 | 73 | ## Usage 74 | 75 | In the repository that will call this action, you will need to add a `.github/workflows/publish-release.yml` file with the following content: 76 | 77 | ### With defaults 78 | 79 | ```yml 80 | name: publish-release 81 | 82 | on: 83 | push: 84 | branches: 85 | - main 86 | 87 | jobs: 88 | publish-release: 89 | uses: mdn/workflows/.github/workflows/publish-release.yml@main 90 | with: 91 | target-repo: "mdn/workflows" 92 | secrets: 93 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 94 | NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} 95 | ``` 96 | 97 | #### Overriding some defaults 98 | 99 | ```yml 100 | name: publish-release 101 | 102 | on: 103 | push: 104 | branches: 105 | - main 106 | 107 | jobs: 108 | publish-release: 109 | uses: mdn/workflows/.github/workflows/publish-release.yml@main 110 | with: 111 | release-type: python 112 | target-repo: "mdn/workflows" 113 | secrets: 114 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 115 | NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} 116 | ``` 117 | 118 | ### Skip NPM publishing 119 | 120 | ```yml 121 | name: publish-release 122 | 123 | on: 124 | push: 125 | branches: 126 | - main 127 | 128 | jobs: 129 | publish-release: 130 | uses: mdn/workflows/.github/workflows/publish-release.yml@main 131 | with: 132 | npm-publish: false 133 | target-repo: "mdn/workflows" 134 | secrets: 135 | GH_TOKEN: ${{ secrets.GH_TOKEN }} 136 | ``` 137 | -------------------------------------------------------------------------------- /docs/set-default-labels.md: -------------------------------------------------------------------------------- 1 | # set-default-labels 2 | 3 | The `set-default-labels` reusable action is located at [`.github/workflows/set-default-labels.yml`](https://github.com/mdn/workflows/tree/main/.github/workflows/set-default-labels.yml). 4 | 5 | This reusable action depends on the following actions: 6 | 7 | - [checkout](https://github.com/marketplace/actions/checkout) 8 | - [lannonbr/issue-label-manager-action](https://github.com/marketplace/actions/issue-label-manager-action) 9 | 10 | ## Inputs 11 | 12 | The action has the following inputs: 13 | 14 | ### Required inputs 15 | 16 | #### target-repo 17 | 18 | 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`. 19 | 20 | - This `input` is required. (`type:string`) 21 | 22 | ### Optional inputs 23 | 24 | #### should-delete-labels 25 | 26 | This is an optional `boolean` input that is `false` by default. If set to `true`, the action will delete any existing labels that are not listed in the JSON file mentioned previously. 27 | 28 | ## Usage 29 | 30 | In the repository that will call this action, you will need to create the following file: `.github/labels.json`. The content of the file can be something like the following: 31 | 32 | ```json 33 | [ 34 | { 35 | "name": "bug", 36 | "color": "#d73a4a", 37 | "description": "something isn’t working" 38 | }, 39 | { 40 | "name": "chore", 41 | "color": "#fef2c0", 42 | "description": "keeping the lights on" 43 | } 44 | ] 45 | ``` 46 | 47 | You can find more details about the above on the [issue-label-manager-action documentation](https://github.com/marketplace/actions/issue-label-manager-action#issue-label-manager-action). The next item you need to create in the repository that will call this action, is a workflow file. You can name the file `.github/workflows/set-default-labels.yml` and add the following content: 48 | 49 | ### With defaults 50 | 51 | ```yml 52 | name: set-default-labels 53 | on: [workflow_dispatch] 54 | 55 | jobs: 56 | set-default-labels: 57 | uses: mdn/workflows/.github/workflows/set-default-labels.yml@main 58 | with: 59 | target-repo: "mdn/workflows" 60 | ``` 61 | 62 | ### Overriding some defaults 63 | 64 | ```yml 65 | name: set-default-labels 66 | on: [workflow_dispatch] 67 | 68 | jobs: 69 | set-default-labels: 70 | uses: mdn/workflows/.github/workflows/set-default-labels.yml@main 71 | with: 72 | target-repo: "mdn/workflows" 73 | should-delete-labels: true 74 | ``` 75 | 76 | Because of the nature of this action, it must be run manually. You can learn more about [manually running actions on GitHub](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow). 77 | --------------------------------------------------------------------------------