{"id":15652096,"url":"https://github.com/technote-space/create-pr-action","last_synced_at":"2025-04-11T14:42:56.274Z","repository":{"id":36301514,"uuid":"217657474","full_name":"technote-space/create-pr-action","owner":"technote-space","description":"GitHub Actions to manage PullRequest","archived":false,"fork":false,"pushed_at":"2024-05-17T16:40:18.000Z","size":21063,"stargazers_count":30,"open_issues_count":5,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T04:34:30.218Z","etag":null,"topics":["github-actions"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/technote-space.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":{"custom":"https://paypal.me/technote0space"}},"created_at":"2019-10-26T04:50:12.000Z","updated_at":"2025-02-27T21:58:42.000Z","dependencies_parsed_at":"2024-06-18T17:07:21.103Z","dependency_job_id":"d1564c9f-ed11-4c65-8ce1-cbd900adf1ef","html_url":"https://github.com/technote-space/create-pr-action","commit_stats":{"total_commits":741,"total_committers":3,"mean_commits":247.0,"dds":0.4520917678812416,"last_synced_commit":"37f467e1e126f36ed53f572b9a8fc43af37c8413"},"previous_names":[],"tags_count":196,"template":false,"template_full_name":"technote-space/gh-actions-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fcreate-pr-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fcreate-pr-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fcreate-pr-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/technote-space%2Fcreate-pr-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/technote-space","download_url":"https://codeload.github.com/technote-space/create-pr-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345822,"owners_count":21088345,"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":["github-actions"],"created_at":"2024-10-03T12:41:20.335Z","updated_at":"2025-04-11T14:42:56.243Z","avatar_url":"https://github.com/technote-space.png","language":"TypeScript","funding_links":["https://paypal.me/technote0space"],"categories":[],"sub_categories":[],"readme":"# Create PR Action\n\n[![CI Status](https://github.com/technote-space/create-pr-action/workflows/CI/badge.svg)](https://github.com/technote-space/create-pr-action/actions)\n[![codecov](https://codecov.io/gh/technote-space/create-pr-action/branch/main/graph/badge.svg)](https://codecov.io/gh/technote-space/create-pr-action)\n[![CodeFactor](https://www.codefactor.io/repository/github/technote-space/create-pr-action/badge)](https://www.codefactor.io/repository/github/technote-space/create-pr-action)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/technote-space/create-pr-action/blob/main/LICENSE)\n\n*Read this in other languages: [English](README.md), [日本語](README.ja.md).*\n\nこれは任意のコマンドを実行して変更をプルリクエストにコミットする `GitHub Actions` です。  \nコンフリクトを解決したり不要になったプルリクエストをクローズしたりするマネジメント機能も備えています。  \n\n## Table of Contents\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\u003cdetails\u003e\n\u003csummary\u003eDetails\u003c/summary\u003e\n\n- [インストール](#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB)\n  - [例：Update npm packages](#%E4%BE%8Bupdate-npm-packages)\n  - [例：Update composer packages](#%E4%BE%8Bupdate-composer-packages)\n  - [例：Mixed](#%E4%BE%8Bmixed)\n- [スクリーンショット](#%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88)\n  - [コマンドの実行](#%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89%E3%81%AE%E5%AE%9F%E8%A1%8C)\n  - [作成されたプルリクエスト](#%E4%BD%9C%E6%88%90%E3%81%95%E3%82%8C%E3%81%9F%E3%83%97%E3%83%AB%E3%83%AA%E3%82%AF%E3%82%A8%E3%82%B9%E3%83%88)\n- [オプション](#%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3)\n- [Action イベント詳細](#action-%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E8%A9%B3%E7%B4%B0)\n  - [対象イベント](#%E5%AF%BE%E8%B1%A1%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88)\n- [変数](#%E5%A4%89%E6%95%B0)\n  - [Variables1](#variables1)\n  - [Variables2](#variables2)\n- [補足](#%E8%A3%9C%E8%B6%B3)\n  - [GITHUB_TOKEN](#github_token)\n- [Author](#author)\n\n\u003c/details\u003e\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## インストール\n### 例：Update npm packages\n例：`.github/workflows/update-npm-packages.yml`\n```yaml\non:\n schedule:\n   - cron: 0 0 * * *\n pull_request:\n   types: [opened, synchronize, reopened, closed]\n\nname: Update packages\njobs:\n release:\n   name: Update npm packages\n   runs-on: ubuntu-latest\n   steps:\n     - name: Update npm packages\n       uses: technote-space/create-pr-action@v2\n       with:\n         EXECUTE_COMMANDS: |\n           npx npm-check-updates -u --packageFile package.json\n           yarn install\n           yarn upgrade\n           yarn audit\n         COMMIT_MESSAGE: 'chore: update npm dependencies'\n         COMMIT_NAME: 'GitHub Actions'\n         COMMIT_EMAIL: 'example@example.com'\n         PR_BRANCH_NAME: 'chore-npm-update-${PR_ID}'\n         PR_TITLE: 'chore: update npm dependencies'\n```\n\n### 例：Update composer packages\n例：`.github/workflows/update-composer-packages.yml`\n```yaml\non:\n schedule:\n   - cron: 0 0 * * *\n pull_request:\n   types: [opened, synchronize, reopened, closed]\n\nname: Update packages\njobs:\n release:\n   name: Update composer packages\n   runs-on: ubuntu-latest\n   steps:\n     - name: Update composer packages\n       uses: technote-space/create-pr-action@v2\n       with:\n         EXECUTE_COMMANDS: |\n           rm -f \"composer.lock\"\n           \u003c \"composer.json\" jq -r '.require | to_entries[] | select(.value | startswith(\"^\")) | select(.key | contains(\"/\")) | .key' | tr '\\n' ' ' | xargs -r php -d memory_limit=2G \"$(command -v composer)\" require --no-interaction --prefer-dist --no-suggest\n           \u003c \"composer.json\" jq -r '.\"require-dev\" | to_entries[] | select(.value | startswith(\"^\")) | select(.key | contains(\"/\")) | .key' | tr '\\n' ' ' | xargs -r php -d memory_limit=2G \"$(command -v composer)\" require --dev --no-interaction --prefer-dist --no-suggest\n         COMMIT_MESSAGE: 'chore: update composer dependencies'\n         COMMIT_NAME: 'GitHub Actions'\n         COMMIT_EMAIL: 'example@example.com'\n         PR_BRANCH_NAME: 'chore-composer-update-${PR_ID}'\n         PR_TITLE: 'chore: update composer dependencies'\n```\n\n### 例：Mixed\n例：`.github/workflows/update-packages.yml`\n```yaml\non:\n schedule:\n   - cron: 0 0 * * *\n pull_request:\n   types: [opened, synchronize, reopened, closed]\n\nname: Update packages\njobs:\n release:\n   name: Update packages\n   runs-on: ubuntu-latest\n   steps:\n     - name: Update packages\n       uses: technote-space/create-pr-action@v2\n       with:\n         EXECUTE_COMMANDS: |\n           npx npm-check-updates -u --packageFile package.json\n           yarn install\n           yarn upgrade\n           yarn audit\n           rm -f \"composer.lock\"\n           \u003c \"composer.json\" jq -r '.require | to_entries[] | select(.value | startswith(\"^\")) | select(.key | contains(\"/\")) | .key' | tr '\\n' ' ' | xargs -r php -d memory_limit=2G \"$(command -v composer)\" require --no-interaction --prefer-dist --no-suggest\n           \u003c \"composer.json\" jq -r '.\"require-dev\" | to_entries[] | select(.value | startswith(\"^\")) | select(.key | contains(\"/\")) | .key' | tr '\\n' ' ' | xargs -r php -d memory_limit=2G \"$(command -v composer)\" require --dev --no-interaction --prefer-dist --no-suggest\n         COMMIT_MESSAGE: 'chore: update dependencies'\n         COMMIT_NAME: 'GitHub Actions'\n         COMMIT_EMAIL: 'example@example.com'\n         PR_BRANCH_NAME: 'chore-update-${PR_ID}'\n         PR_TITLE: 'chore: update dependencies'\n```\n\n[More details of target event](#action-event-details)\n\n## スクリーンショット\n### コマンドの実行\n![run command](https://raw.githubusercontent.com/technote-space/create-pr-action/images/screenshot-1.png)\n\n### 作成されたプルリクエスト\n![pull request](https://raw.githubusercontent.com/technote-space/create-pr-action/images/screenshot-2.png)\n\n## オプション\n| name | description | default | required | e.g. |\n|:---:|:---|:---:|:---:|:---:|\n|GLOBAL_INSTALL_PACKAGES|グローバルにインストールするパッケージ| | |`imagemin-cli`|\n|EXECUTE_COMMANDS|実行するコマンド| | | |\n|COMMIT_MESSAGE|コミットメッセージ| | | |\n|COMMIT_NAME|コミット時に設定する名前|`${github.actor}`| | |\n|COMMIT_EMAIL|コミット時に設定するメールアドレス|`${github.actor}@users.noreply.github.com`| | |\n|PR_BRANCH_PREFIX|ブランチ名のプリフィックス|`create-pr-action/`|true|`imagemin/`|\n|PR_BRANCH_NAME|ブランチ名\u003cbr\u003eいくつかの変数が使用可能です ([variables1](#variables1))| |true|`imagemin-${PR_ID}`|\n|PR_TITLE|プルリクエストのタイトル\u003cbr\u003eいくつかの変数が使用可能です ([variables1](#variables1))| |true|`chore: minify images`|\n|PR_BODY|プルリクエストの本文\u003cbr\u003eいくつかの変数が使用可能です ([variables2](#variables2))| |true| |\n|CHECK_DEFAULT_BRANCH|デフォルトブランチをチェックするかどうか|`true`| |`false`|\n|ONLY_DEFAULT_BRANCH|デフォルトブランチ以外をチェックしないかどうか|`pull_request: false` \u003cbr\u003e `else: true`| |`true`|\n|GITHUB_TOKEN|アクセストークン|`${{github.token}}`|true|`${{secrets.ACCESS_TOKEN}}`|\n\n## Action イベント詳細\n### 対象イベント\n| eventName | action |\n|:---:|:---:|\n|pull_request|opened, synchronize, reopened, labeled, unlabeled|\n|pull_request|closed|\n|schedule, repository_dispatch, workflow_dispatch|*|\n\n- 次のアクティビティタイプは明示的に指定する必要があります ([detail](https://docs.github.com/ja/actions/using-workflows/events-that-trigger-workflows#pull_request))\n  - `labeled`, `unlabeled`, `closed`\n\n## 変数\n### Variables1\n| name | description |\n|:---|:---|\n| PR_NUMBER | pull_request.number (例：`11`) |\n| PR_NUMBER_REF | `#${pull_request.number}` (例：`#11`) |\n| PR_ID | pull_request.id (例：`21031067`) |\n| PR_HEAD_REF | pull_request.head.ref (例：`change`) |\n| PR_BASE_REF | pull_request.base.ref (例：`main`) |\n| PR_TITLE | pull_request.title (例：`Update the README with new information.`) |\n| PATCH_VERSION | new patch version (e.g. `v1.2.4`) |\n| MINOR_VERSION | new minor version (e.g. `v1.3.0`) |\n| MAJOR_VERSION | new major version (e.g. `v2.0.0`) |\n\n### Variables2\n- [variables1](#variables1)\n\n| name | description |\n|:---|:---|\n| PR_LINK | プルリクエストへのリンク |\n| COMMANDS_OUTPUT | コマンドの結果 |\n| FILES_SUMMARY | 例：`Changed 2 files` |\n| FILES | 変更されたファイル一覧 |\n\n## 補足\n### GITHUB_TOKEN\nGitHub Actions で提供される`GITHUB_TOKEN`は連続するイベントを作成する権限がありません。  \nしたがって、プッシュによってトリガーされるビルドアクションなどは実行されません。  \nこれはブランチプロテクションを設定していると問題になる場合があります。  \n\nもしアクションをトリガーしたい場合は代わりに`personal access token`を使用してください。  \n1. public_repo または repo の権限で [Personal access token](https://docs.github.com/ja/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) を生成  \n(repo はプライベートリポジトリで必要です)  \n1. [ACCESS_TOKENとして保存](https://docs.github.com/ja/actions/security-guides/encrypted-secrets)\n1. `GITHUB_TOKEN`の代わりに`ACCESS_TOKEN`を使用するように設定  \n   例：`.github/workflows/update-packages.yml`\n   ```yaml\n   on:\n     schedule:\n       - cron: 0 0 * * *\n     pull_request:\n       types: [opened, synchronize, reopened, closed]\n\n   name: Update packages\n   jobs:\n     release:\n       name: Update npm packages\n       runs-on: ubuntu-latest\n       steps:\n         - name: Update npm packages\n           uses: technote-space/create-pr-action@v2\n           with:\n             GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}\n             EXECUTE_COMMANDS: |\n               npx npm-check-updates -u --packageFile package.json\n               yarn install\n               yarn upgrade\n               yarn audit\n             COMMIT_MESSAGE: 'chore: update npm dependencies'\n             COMMIT_NAME: 'GitHub Actions'\n             COMMIT_EMAIL: 'example@example.com'\n             PR_BRANCH_NAME: 'chore-npm-update-${PR_ID}'\n             PR_TITLE: 'chore: update npm dependencies'\n   ```\n\n## Author\n[GitHub (Technote)](https://github.com/technote-space)  \n[Blog](https://technote.space)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnote-space%2Fcreate-pr-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechnote-space%2Fcreate-pr-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechnote-space%2Fcreate-pr-action/lists"}