Harry
Harry

Reputation: 54999

GitHub Actions get from API to create pull request

Is there a way to tell GitHub to automatically create a pull request from an API providing JSON content and merge it into my project?

I want to:

  1. Edit files on a platform (I control the platform) using my own production editors/tools.
  2. Have GitHub request it (REST), then create a PR or a commit, so people can collaborate on it with forks/GitHub project management.
  3. Push from GitHub back to the platform for publishing.

3 is no problem, but 2 I can't find documentation for if it's even possible.

Upvotes: 3

Views: 1229

Answers (1)

Harry
Harry

Reputation: 54999

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/[email protected]
      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 }}"

Upvotes: 2

Related Questions