{"id":20050093,"url":"https://github.com/mithriljs/infra","last_synced_at":"2025-03-02T08:27:41.822Z","repository":{"id":256389052,"uuid":"853274081","full_name":"MithrilJS/infra","owner":"MithrilJS","description":"MithrilJS global deploy scripts","archived":false,"fork":false,"pushed_at":"2025-02-15T06:22:50.000Z","size":1907,"stargazers_count":0,"open_issues_count":5,"forks_count":1,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-15T07:26:05.463Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MithrilJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"mithriljs"}},"created_at":"2024-09-06T10:31:39.000Z","updated_at":"2025-02-15T06:21:26.000Z","dependencies_parsed_at":"2025-01-23T04:32:03.547Z","dependency_job_id":null,"html_url":"https://github.com/MithrilJS/infra","commit_stats":null,"previous_names":["mithriljs/infra"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MithrilJS%2Finfra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MithrilJS%2Finfra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MithrilJS%2Finfra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MithrilJS%2Finfra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MithrilJS","download_url":"https://codeload.github.com/MithrilJS/infra/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241481034,"owners_count":19969781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-13T11:54:03.662Z","updated_at":"2025-03-02T08:27:41.795Z","avatar_url":"https://github.com/MithrilJS.png","language":"JavaScript","readme":"# MithrilJS shared infra workflows and scripts\n\nThis handles all deploy processes and centralizes all the permissions. It also includes some utility scripts\n\n\u003e Admins should consult [the runbook](./RUNBOOK.md) as well.\n\n- [Deploy](#deploy)\n- [Define tests](#define-tests)\n- [Block a PR with a comment](#block-a-pr-with-a-comment)\n- [Notify triage](#notify-triage)\n- [License](#license)\n\n## Deploy\n\nIt's a multi-step process.\n\n1. Determine the repo you want to add it to. Anywhere you see `$REPO` here, substitute that with the name of the repo you chose.\n2. Determine the module name you want to publish or register. Anywhere you see `$MODULE` here, substitute that with the name of the module you chose.\n3. If your package requires publishing to a new npm module, reach out to an admin to create a new local access token if needed and tell you what to fill. You will need to rebase your pull request for later steps with this repo name, or (better) just allow maintainers to write to your pull request. The admin will also set up a secret for you to send deploy requests with.\n4. Add the personal access token as the `DEPLOY_TOKEN` secret (or whatever the admin told you).\n5. Create a pull request to the source repo where you want to call from, with the following (adjusted as needed):\n   - Deploy to npm:\n     ```yml\n     - uses: MithrilJS/infra/deploy@main\n       with:\n         type: npm\n         token: ${{ secrets.DEPLOY_TOKEN }}\n     ```\n   To deploy a package not located in the repo root, set the `root_dir` option:\n   ```yml\n   with:\n     root_dir: ${{ github.workspace }}/path/to/package\n   ```\n\n## Define tests\n\nTests are extremely easy to set up. First, ensure you have `build`, `lint`, and `test` scripts in your `package.json`. Then, you can just do this, which runs `npm run lint` and `npm run build`.\n\n```yml\non:\n  pull_request:\n    types: [opened, synchronize]\n    branches: [main]\n  push:\n    branches: [main]\npermissions:\n  actions: write\n  contents: read\njobs:\n  test:\n    uses: MithrilJS/infra/.github/workflows/run-tests.yml\n```\n\nIf you want to run tests on Node, you can add `test-node: true`. This is useful in a strictly non-Node project.\n\n```yml\non:\n  pull_request:\n    types: [opened, synchronize]\n    branches: [main]\n  push:\n    branches: [main]\npermissions:\n  actions: write\n  contents: read\njobs:\n  test:\n    uses: MithrilJS/infra/.github/workflows/run-tests.yml\n    with:\n      test-node: true\n```\n\nIf you want to test on Deno, you can add `test-deno: true`. You should also add a `deno.json` to your project with a `test` task. Note that building and linting will still use Node.\n\n```yml\non:\n  pull_request:\n    types: [opened, synchronize]\n    branches: [main]\n  push:\n    branches: [main]\npermissions:\n  actions: write\n  contents: read\njobs:\n  test:\n    uses: MithrilJS/infra/.github/workflows/run-tests.yml\n    with:\n      test-deno: true\n```\n\nYou can run tests on both Node and Deno by just specifying both `test-node: true` and `test-deno: true`.\n\n```yml\non:\n  pull_request:\n    types: [opened, synchronize]\n    branches: [main]\n  push:\n    branches: [main]\npermissions:\n  actions: write\n  contents: read\njobs:\n  test:\n    uses: MithrilJS/infra/.github/workflows/run-tests.yml\n    with:\n      test-node: true\n      test-deno: true\n```\n\nIf you want to run across all OS platforms, you can add `all-platforms: true`.\n\n```yml\non:\n  pull_request:\n    types: [opened, synchronize]\n    branches: [main]\n  push:\n    branches: [main]\npermissions:\n  actions: write\n  contents: read\njobs:\n  test:\n    uses: MithrilJS/infra/.github/workflows/run-tests.yml\n    with:\n      all-platforms: true\n```\n\nIf you want to run across all runtime versions, you can add `all-versions: true`. This can be combined with `all-platforms: true`.\n\n```yml\non:\n  pull_request:\n    types: [opened, synchronize]\n    branches: [main]\n  push:\n    branches: [main]\npermissions:\n  actions: write\n  contents: read\njobs:\n  test:\n    uses: MithrilJS/infra/.github/workflows/run-tests.yml\n    with:\n      all-versions: true\n```\n\n## Block a PR with a comment\n\nUsage is pretty simple. Suppose development is occurring on `main` and the PR is to the special branch `release`. You can use this workflow to handle it easily.\n\n```yml\nname: Deny pushing to `release`\non:\n  pull_request:\n    types: [opened]\n    branches: [release]\njobs:\n  reject:\n    uses: MithrilJS/infra/.github/workflows/reject-pr.yml@main\n    secrets: inherit\n```\n\nIf the right branch isn't `main`, you can specify it explicitly. Suppose it's `next` instead. It's still just as easy.\n\n```yml\nname: Deny pushing to `release`\non:\n  pull_request:\n    types: [opened]\n    branches: [release]\njobs:\n  reject:\n    uses: MithrilJS/infra/.github/workflows/reject-pr.yml@main\n    secrets: inherit\n    with:\n      correct_branch: next\n```\n\n## Notify triage\n\nUsage is extremely simple. This also implicitly adds the issue to [our tracking project](https://github.com/orgs/MithrilJS/projects/2) for triage.\n\n```yml\nname: Notify triage on issue create\non:\n  issues:\n    types: [opened]\n  pull_request:\n    types: [opened]\njobs:\n  reject:\n    uses: MithrilJS/infra/.github/workflows/notify-triage.yml@main\n    secrets: inherit\n```\n\n## License\n\nCopyright 2024 Mithril.js Contributors\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\nYou can also find a copy of the license [here](./LICENSE).\n","funding_links":["https://opencollective.com/mithriljs"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmithriljs%2Finfra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmithriljs%2Finfra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmithriljs%2Finfra/lists"}