Day 16: Create Pull Requests
December 16, 2019
This Action, peter-evans/create-pull-request by Peter Evans will generate Pull requests after making changes in the repo in a workflow.
Example Usage
One usecase Peter made in his examples is a workflow to update NPM modules once a week and then push a PR with the changes.
name: Update Dependencieson:schedule:- cron: "0 10 * * 1"jobs:update-deps:runs-on: ubuntu-lateststeps:# checkout the repo- uses: actions/checkout@v1# setup node 10- uses: actions/setup-node@v1with:node-version: "10.x"# run npm-check-updates- name: Update dependenciesid: varsrun: |npm install -g npm-check-updatesncu -unpm install# generate the PR- name: Create Pull Requestuses: peter-evans/create-pull-request@v1with:token: ${{ secrets.GITHUB_TOKEN }}commit-message: update dependenciestitle: Automated Dependency Updatesbody: This is an auto-generated PR with dependency updates.branch: dep-updatesbranch-suffix: none
The GITHUB_TOKEN
is required. Otherwise all other fields are optional but can be set to add labels, body, etc to the PR rather needing to do it once the PR is made. title
, commit-message
, branch
, and body
are good to fill in.