{"id":13725243,"url":"https://github.com/OSS-Docs-Tools/code-owner-self-merge","last_synced_at":"2025-05-07T19:33:29.013Z","repository":{"id":47255583,"uuid":"211593850","full_name":"OSS-Docs-Tools/code-owner-self-merge","owner":"OSS-Docs-Tools","description":"A GitHub Action for letting CODEOWNERS merge PRs via green PR reviews","archived":false,"fork":false,"pushed_at":"2024-06-08T07:21:33.000Z","size":3071,"stargazers_count":53,"open_issues_count":11,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-04T14:46:38.275Z","etag":null,"topics":["actions","github-actions","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OSS-Docs-Tools.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":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-29T02:58:01.000Z","updated_at":"2024-09-24T02:46:19.000Z","dependencies_parsed_at":"2024-04-28T16:31:53.953Z","dependency_job_id":"c1fb212a-4426-4153-ae3f-c2d0ccb6fbe7","html_url":"https://github.com/OSS-Docs-Tools/code-owner-self-merge","commit_stats":{"total_commits":83,"total_committers":6,"mean_commits":"13.833333333333334","dds":0.3855421686746988,"last_synced_commit":"7abfe9ecd2f05b3f58adebf7e73212690cdef8f4"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSS-Docs-Tools%2Fcode-owner-self-merge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSS-Docs-Tools%2Fcode-owner-self-merge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSS-Docs-Tools%2Fcode-owner-self-merge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OSS-Docs-Tools%2Fcode-owner-self-merge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OSS-Docs-Tools","download_url":"https://codeload.github.com/OSS-Docs-Tools/code-owner-self-merge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224645273,"owners_count":17346108,"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":["actions","github-actions","javascript"],"created_at":"2024-08-03T01:02:16.785Z","updated_at":"2025-05-07T19:33:29.008Z","avatar_url":"https://github.com/OSS-Docs-Tools.png","language":"JavaScript","readme":"A GitHub action that lets code-owners merge PRs via a comment.\n\nThis action uses the standardized structure of [a CODEOWNERS file](https://github.blog/2017-07-06-introducing-code-owners/) to handle the access controls.\n\n\u003cimg src=\"screenshots/img.png\"\u003e\n\n## A simple example\n\nSo, with this file at: `.github/CODEOWNERS`:\n\n```sh\nREADME.md @orta\n```\n\nIf a PR contained _only_ a change to the `README.md` - this action would say that \"@orta has the ability to merge by commenting 'LGTM'\".\n\nThen, when/if this happens the GitHub Action will merge for you.\n\n## A real-world example\n\n`.github/CODEOWNERS`:\n\n```sh\n# Collaborators for Japanese Translation of the Website\npackages/playground-examples/copy/ja/**/*.md @sasurau4 @Quramy @Naturalclar @Takepepe @orta\npackages/tsconfig-reference/copy/ja/**/*.md @sasurau4 @Quramy @Naturalclar @Takepepe @orta\npackages/typescriptlang-org/src/copy/ja/**/*.md @sasurau4 @Quramy @Naturalclar @Takepepe @orta\npackages/documentation/copy/ja/**/*.ts @sasurau4 @Quramy @Naturalclar @Takepepe @orta\n```\n\nThis allows any of `@sasurau4`, `@Quramy`,  `@Naturalclar`, `@Takepepe` or `@orta` to merge PRs which affect their areas of the translation process in the TypeScript Website repo. Code owners can use a [review](https://github.com/orta/code-owner-self-merge/pull/3), or a [comment](https://github.com/orta/code-owner-self-merge/pull/1) to merge.\n\n## Setting It Up\n\nYou want a unique workflow file, e.g. `.github/workflows/codeowners-merge.yml`\n\n```yml\nname: Codeowners merging\non:\n  pull_request_target: { types: [opened] }\n  issue_comment: { types: [created] }\n  pull_request_review: { types: [submitted] }\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v4\n      - name: Run Codeowners merge check\n        uses: OSS-Docs-Tools/code-owner-self-merge@1.6.8\n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\nThen you should be good to go. Note that I might not have bumped the version in `^`, so double [check the releases.](https://github.com/OSS-Docs-Tools/code-owner-self-merge/releases). Also, given that this is a security focused GitHub Action, I'd recommend instead using commit references instead of `@x.y.z`.\n\n### Security\n\nWe force the use of [`pull_request_target`](https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/) as a workflow event to ensure that someone cannot change the CODEOWNER files at the same time as having that change be used to validate if they can merge.\n\n### Issue / PR manipulation\n\nMerging a PR has strict security requirements, but closing a PR or Issue can have a weaker one. Anyone with a GitHub login in the CODEOWNER has the ability to close any PR / Issue via a comment/review which includes:\n\n```\n@github-actions close\n```\n\nA closed PR can be re-opened with:\n\n```\n@github-actions reopen\n```\n\n### Extras\n\nYou can use this label to set labels for specific sections of the codebase, by having square brackets to indicate labels to make: `[label]`\n\n```sh\n# Collaborators for Spanish Translation of the Website\npackages/playground-examples/copy/es/**/*.md @KingDarBoja [translate] [es]\npackages/playground-examples/copy/es/**/*.ts @KingDarBoja [translate] [es]\npackages/tsconfig-reference/copy/es/**/*.md @KingDarBoja [translate] [es]\npackages/typescriptlang-org/src/copy/es/**/*.ts @KingDarBoja [translate] [es]\npackages/documentation/copy/es/**/*.ts @KingDarBoja [translate] [es]\n```\n\n## Config\n\nThere are six options available at the moment:\n\n- `cwd`, which can be used to determine the root folder to look for CODEOWNER files in.\n- `merge_method`, which can be `merge` (default), `squash` or `rebase`, depending on what you want the action to do.\n- `quiet` - does not output a message saying who can merge PRs\n- `ownerNoPings` - list of usernames to wrap mention in an inline code block to prevent pinging\n\n```yml\n- name: Run Codeowners merge check\n  uses: OSS-Docs-Tools/code-owner-self-merge@v1\n  env:\n    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n  with:\n    cwd: './docs'\n    merge_method: 'squash'\n```\n\nThen 2 for handling fallbacks on PRs which aren't able to be maintained by anyone in the CODEOWNERs:\n\n- `if_no_maintainers_add_label` - A label to add which denotes it is a maintainers PR to handle\n- `if_no_maintainers_assign` - A string of `@` prefixed GitHub usernames, separated by spaces which denotes who should be assigned to PRs which don't get a CODEOWNER.\n\n```yml\n- name: Run Codeowners merge check\n  uses: OSS-Docs-Tools/code-owner-self-merge@v1\n  env:\n    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n  with:\n    merge_method: 'squash'\n    if_no_maintainers_add_label: 'maintainers'\n    if_no_maintainers_assign: '@orta @sandersn'\n```\n\n### Dev\n\nUse `npx jest --watch` to run tests.\n\n### Deploy\n\nUse the GH UI to make a tag and release.\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOSS-Docs-Tools%2Fcode-owner-self-merge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOSS-Docs-Tools%2Fcode-owner-self-merge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOSS-Docs-Tools%2Fcode-owner-self-merge/lists"}