GitHub Actions从API获取创建拉取请求。

3
有没有一种方法可以让GitHub从提供JSON内容的API自动创建拉取请求并将其合并到我的项目中?
我想要:
1.使用自己的生产编辑器/工具在平台上编辑文件(我控制平台)。
2.让GitHub请求它(REST),然后创建PR或提交,以便人们可以使用分支/GitHub项目管理进行协作。
3.从GitHub推回平台以进行发布。
第3步没有问题,但是对于第2步,如果可能的话,我找不到文档。

答案可以是否定的,我会接受的。 - Harry
GitHub需要一个操作来触发github-action运行 - 支持数十个操作,因此作为(1)的一部分,您可以更新GitHub存储库上的某些内容,或者您可以按计划运行操作(https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule)- 您可以尝试使用https://github.com/marketplace/actions/http-request-action进行REST位(2)- 然后使用https://github.com/marketplace/actions/create-pull-request进行PR(2)。 - PJ Fanning
@PJFanning,我明白了,那么要么设置一个计划,要么执行任意操作来触发该动作,比如创建一个新问题?然后该动作可以创建PR。它只是PR还是能够创建PR所需的新文件?这一切都可以通过该动作完成吗?如果是这样,请继续回答,我会把它给你。 - Harry
好的,在更多的探索之后,我现在明白了这是如何工作的。Github文档没有涵盖任何内容,因为默认操作非常有限。相反,有一个行动市场,其中包含我需要的功能,包括httpr、创建文件、创建PR。你可以将它们串起来完成这个任务。操作可以手动触发,也可以定时触发,所以没问题。感谢@PJFanning指引我正确的方向。 - Harry
1个回答

2
name: Manual workflow
on:
  workflow_dispatch:
jobs:
  makefiles:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    - uses: actions/checkout@v2
    - name: Getting
      uses: fjogeleit/http-request-action@master
      id: myRequest
      with:
        url: 'https://domain/api/file'
        method: 'GET'
    - name: Show File
      run: echo ${{ steps.myRequest.outputs.response }}
    - name: Create A File
      uses: 1arp/create-a-file-action@0.2
      with:
        path: 'src'
        file: 'foo.bar'
        content: ${{steps.myRequest.outputs.response}}
    - name: final commit
      uses: zwaldowski/git-commit-action@v1
      id: git_commit
    - name: show
      run: echo "${{ steps.git_commit.outputs.sha }}"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接