Create Pull Request after deleting files using GitHub Actions

Viewed 63

I'm making an action that runs a script that deletes some files from a github repository and I want to create a pull request with those changes. So far the structure is like this:

#myactionscript.yml
name: test
on: push

jobs:
  delete:
    runs-on: ubuntu-latest
    steps:

      #setup steps
      ...

      - name: delete files
        run: |
          #script that deletes files

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4.0.4

I published the action so I could test it on a private repo. If I print the folder contents, I can see that the file deletion script is working, but the pull request is not being created. However, it does work when I use it externally on my private repo, like this:

#privaterepoworkflow.yml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: File deletion
        uses: myuser/deletion-action@test5

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v4.0.4

This creates the Pull Request with the deleted files, but it requires me to add the code snippet to my private repo, so for every repository that I wanna run this action on, I will also have to paste the Create Pull Request snippet. Is there any way to make it so the Pull Request is created while adding this snippet only in the delete action itself?

0 Answers
Related