All Projects → technote-space → create-pr-action

technote-space / create-pr-action

Licence: MIT license
GitHub Actions to manage PullRequest

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to create-pr-action

pytest-github-actions-annotate-failures
Pytest plugin to annotate failed tests with a workflow command for GitHub Actions
Stars: ✭ 58 (+152.17%)
Mutual labels:  github-actions
pull-request-artifacts
GitHub Action to post build artifacts in PR comments.
Stars: ✭ 23 (+0%)
Mutual labels:  github-actions
codacy-analysis-cli-action
GitHub Action for the codacy-analysis-cli
Stars: ✭ 42 (+82.61%)
Mutual labels:  github-actions
NextCommunity.github.io
Join FREE: Community of open-source programmers and software engineers.
Stars: ✭ 29 (+26.09%)
Mutual labels:  github-actions
private-actions-checkout
GitHub Action to make custom private actions easily available to any workflow
Stars: ✭ 62 (+169.57%)
Mutual labels:  github-actions
hugo-action
Commands to help with building Hugo based static sites
Stars: ✭ 65 (+182.61%)
Mutual labels:  github-actions
zola-deploy-action
Github action for building a Zola site and deploying to Github Pages
Stars: ✭ 131 (+469.57%)
Mutual labels:  github-actions
Spiderpig86
💎 Me. This is a self-updating README. Star it if you like it :)
Stars: ✭ 40 (+73.91%)
Mutual labels:  github-actions
BiliTools
支持Docker,青龙面板,以及各种云函数,阿里云,腾讯云,华为云,百度云。
Stars: ✭ 142 (+517.39%)
Mutual labels:  github-actions
AndroidFastlaneCICD
📱A sample repository to demonstrate the Automate publishing🚀 app to the Google Play Store with GitHub Actions⚡+ Fastlane🏃.
Stars: ✭ 82 (+256.52%)
Mutual labels:  github-actions
noise-php
A starter-kit for your PHP project.
Stars: ✭ 52 (+126.09%)
Mutual labels:  github-actions
link-snitch
GitHub Action to scan your site for broken links so you can fix them 🔗
Stars: ✭ 50 (+117.39%)
Mutual labels:  github-actions
action-cats
A quick Github action which posts a cat gif on your PRs to reward you for pushing code!
Stars: ✭ 64 (+178.26%)
Mutual labels:  github-actions
setup-protoc
GitHub Action to setup the protoc compiler for protocol buffers
Stars: ✭ 58 (+152.17%)
Mutual labels:  github-actions
xray-action
... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Stars: ✭ 16 (-30.43%)
Mutual labels:  github-actions
prettier
🔨 Native, blazingly-fast Prettier CLI on Github Actions
Stars: ✭ 19 (-17.39%)
Mutual labels:  github-actions
components-nightly
⚙️ GitHub Action for searching nightly component availability
Stars: ✭ 21 (-8.7%)
Mutual labels:  github-actions
wiki-page-creator-action
Create a GitHub wiki page based on the provided markdown file
Stars: ✭ 71 (+208.7%)
Mutual labels:  github-actions
assign-one-project-github-action
Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.
Stars: ✭ 140 (+508.7%)
Mutual labels:  github-actions
release-downloader
Github action to download release assets from private or public repositories
Stars: ✭ 33 (+43.48%)
Mutual labels:  github-actions

Create PR Action

CI Status codecov CodeFactor License: MIT

Read this in other languages: English, 日本語.

This is a GitHub Actions that executes an arbitrary command and commits the changes to the new pull request.
It also has a management function that resolves conflicts and closes pull requests that are no longer needed.

Table of Contents

Details

Installation

e.g. Update npm packages

e.g. .github/workflows/update-npm-packages.yml

on:
 schedule:
   - cron: 0 0 * * *
 pull_request:
   types: [opened, synchronize, reopened, closed]

name: Update packages
jobs:
 release:
   name: Update npm packages
   runs-on: ubuntu-latest
   steps:
     - name: Update npm packages
       uses: technote-space/create-pr-action@v2
       with:
         EXECUTE_COMMANDS: |
           npx npm-check-updates -u --packageFile package.json
           yarn install
           yarn upgrade
           yarn audit
         COMMIT_MESSAGE: 'chore: update npm dependencies'
         COMMIT_NAME: 'GitHub Actions'
         COMMIT_EMAIL: '[email protected]'
         PR_BRANCH_NAME: 'chore-npm-update-${PR_ID}'
         PR_TITLE: 'chore: update npm dependencies'

e.g. Update composer packages

e.g. .github/workflows/update-composer-packages.yml

on:
 schedule:
   - cron: 0 0 * * *
 pull_request:
   types: [opened, synchronize, reopened, closed]

name: Update packages
jobs:
 release:
   name: Update composer packages
   runs-on: ubuntu-latest
   steps:
     - name: Update composer packages
       uses: technote-space/create-pr-action@v2
       with:
         EXECUTE_COMMANDS: |
           rm -f "composer.lock"
           < "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
           < "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
         COMMIT_MESSAGE: 'chore: update composer dependencies'
         COMMIT_NAME: 'GitHub Actions'
         COMMIT_EMAIL: '[email protected]'
         PR_BRANCH_NAME: 'chore-composer-update-${PR_ID}'
         PR_TITLE: 'chore: update composer dependencies'

e.g. Mixed

e.g. .github/workflows/update-packages.yml

on:
 schedule:
   - cron: 0 0 * * *
 pull_request:
   types: [opened, synchronize, reopened, closed]

name: Update packages
jobs:
 release:
   name: Update packages
   runs-on: ubuntu-latest
   steps:
     - name: Update packages
       uses: technote-space/create-pr-action@v2
       with:
         EXECUTE_COMMANDS: |
           npx npm-check-updates -u --packageFile package.json
           yarn install
           yarn upgrade
           yarn audit
           rm -f "composer.lock"
           < "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
           < "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
         COMMIT_MESSAGE: 'chore: update dependencies'
         COMMIT_NAME: 'GitHub Actions'
         COMMIT_EMAIL: '[email protected]'
         PR_BRANCH_NAME: 'chore-update-${PR_ID}'
         PR_TITLE: 'chore: update dependencies'

More details of target event

Screenshots

Run commands

run command

Created Pull Request

pull request

Options

name description default required e.g.
GLOBAL_INSTALL_PACKAGES Packages to be global installed imagemin-cli
EXECUTE_COMMANDS Commands to be executed
COMMIT_MESSAGE Commit message
COMMIT_NAME Git commit name ${github.actor}
COMMIT_EMAIL Git commit email ${github.actor}@users.noreply.github.com
PR_BRANCH_PREFIX PullRequest branch prefix create-pr-action/ true imagemin/
PR_BRANCH_NAME PullRequest branch name
Several variables are available (variables1)
true imagemin-${PR_ID}
PR_TITLE PullRequest title
Several variables are available (variables1)
true chore: minify images
PR_BODY PullRequest body
Several variables are available (variables2)
true
CHECK_DEFAULT_BRANCH Whether to check default branch true false
ONLY_DEFAULT_BRANCH Whether not to check other than default branch pull_request: false
else: true
true
AUTO_MERGE_THRESHOLD_DAYS Threshold days to auto merge
Detail
30
GITHUB_TOKEN アクセストークン ${{github.token}} true ${{secrets.ACCESS_TOKEN}}

Perform an automatic merge under the following conditions:

  • The number of days has passed since the PR was created
  • All checks are Success
  • Mergeable

Action event details

Target event

eventName action
pull_request opened, synchronize, reopened, labeled, unlabeled
pull_request closed
schedule, repository_dispatch, workflow_dispatch *
  • The following activity types must be explicitly specified (detail)
    • labeled, unlabeled, closed

Variables

Variables1

name description
PR_NUMBER pull_request.number (e.g. 11)
PR_NUMBER_REF #${pull_request.number} (e.g. #11)
PR_ID pull_request.id (e.g. 21031067)
PR_HEAD_REF pull_request.head.ref (e.g. change)
PR_BASE_REF pull_request.base.ref (e.g. main)
PR_TITLE pull_request.title (e.g. Update the README with new information.)
PATCH_VERSION new patch version (e.g. v1.2.4)
MINOR_VERSION new minor version (e.g. v1.3.0)
MAJOR_VERSION new major version (e.g. v2.0.0)

Variables2

name description
PR_LINK Link to PR
COMMANDS_OUTPUT Results of command
FILES_SUMMARY e.g. Changed 2 files
FILES Changed file list

Addition

GITHUB_TOKEN

The GITHUB_TOKEN that is provided as a part of GitHub Actions doesn't have authorization to create any successive events.
So it won't spawn actions which triggered by push.
This can be a problem if you have branch protection configured.

If you want to trigger actions, use a personal access token instead.

  1. Generate a personal access token with the public_repo or repo scope.
    (repo is required for private repositories).
  2. Save as ACCESS_TOKEN
  3. Add input to use ACCESS_TOKEN instead of GITHUB_TOKEN.
    e.g. .github/workflows/update-packages.yml
    on:
      schedule:
        - cron: 0 0 * * *
      pull_request:
        types: [opened, synchronize, reopened, closed]
    
    name: Update packages
    jobs:
      release:
        name: Update npm packages
        runs-on: ubuntu-latest
        steps:
          - name: Update npm packages
            uses: technote-space/create-pr-action@v2
            with:
              GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
              EXECUTE_COMMANDS: |
                npx npm-check-updates -u --packageFile package.json
                yarn install
                yarn upgrade
                yarn audit
              COMMIT_MESSAGE: 'chore: update npm dependencies'
              COMMIT_NAME: 'GitHub Actions'
              COMMIT_EMAIL: '[email protected]'
              PR_BRANCH_NAME: 'chore-npm-update-${PR_ID}'
              PR_TITLE: 'chore: update npm dependencies'

Auto merge

Perform an automatic merge under the following conditions:

  • AUTO_MERGE_THRESHOLD_DAYS option is set
  • No changes in this run
  • The number of days has passed since the PR was created
  • All checks are Success
  • Mergeable

Author

GitHub (Technote)
Blog

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].