使用 github 操作创建拉取请求

时间:2021-06-20 16:09:02

标签: github github-actions pull-request

我正在努力让它发挥作用,但在触发 peter-evans PR 之前,我也很困惑它之间缺少什么。

场景非常简单,我喜欢在任何 feature/* 分支上推送自动创建 PR,但相反,我遇到了奇怪的场景,其中开发更改应用于 feature/* 分支之上。有人可以给我提示吗?

name: Pull Request Action
on:
  push:
    branches:
      - feature/*

jobs:
  create-pull-request:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          ref: develop
      
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3.10.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-message: Simple demo
          title: '[Example] Simple demo'
          body: >
            This PR is auto-generated by 
            [create-pull-request](https://github.com/peter-evans/create-pull-request).
          labels: feature, automated pr
          branch: feature/workflow-demo

1 个答案:

答案 0 :(得分:0)

通读自述文件,Peter Evans 的操作与您想要实现的目标不符。但是你可以使用 repo-sync's pull-request action:

name: Pull Request Action
on:
  push:
    branches:
      - feature/*

jobs:
  create-pull-request:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v2
      - name: pull-request
        uses: repo-sync/pull-request@v2
        with:
          destination_branch: "develop"
          github_token: ${{ secrets.GITHUB_TOKEN }}
          pr_label: "feature, automated pr"
          pr_title: "[Example] Simple demo"