peter-evans / create-pull-request

A GitHub action to create a pull request for changes to your repository in the actions workspace
MIT License
2.15k stars 424 forks source link

v3 is failing for the same CI #660

Closed tarunmangukiya closed 3 years ago

tarunmangukiya commented 3 years ago

Subject of the issue

I am receiving the error: When the repository is checked out on a commit instead of a branch, the 'base' input must be supplied.

It was working perfect like 2 months back with v1, but now I am seeing it failing for v1 as well as v3.

Steps to reproduce

You can check the logs at: https://github.com/Iconscout/unicons/pull/118/checks?check_run_id=1528930610

peter-evans commented 3 years ago

Hi @tarunmangukiya

As the message explains, you need to provide the base input because you are checked out on the pull request merge commit, which is not a branch. What is the intended base of your pull request?

You are running the action on pull_request and on push to master. Is that intentional? Please explain to me when you want to create a pull request and what the base of the pull request should be. I might be able to help you further with that information.

tarunmangukiya commented 3 years ago

What We are doing is that, whenever someone pushes to the PR, I want to make sure that some of the resources are up to date with our API gateway. If they are not then create a PR with updated resources which we can simply merge.

This helps us to keep the workflow smooth.

For example, Unicons is an icon library, and those are uploaded to Iconscout. We pull them when someone pushes to the PR.

peter-evans commented 3 years ago

Try this:

jobs:
  update-icons:
    runs-on: ubuntu-latest
    steps:
-     - uses: actions/checkout@v1
+     - if: github.event_name == 'push' 
+       uses: actions/checkout@v2
+     - if: github.event_name == 'pull_request' 
+       uses: actions/checkout@v2
+       with:
+         ref: ${{ github.head_ref }}
      - uses: actions/setup-node@v1
        with:
          node-version: 10.16.3
      - name: Download Line Icons
        run: npm ci --progress=false && npm run line:download
        env:
          API_DOWNLOAD_LINE: ${{ secrets.API_DOWNLOAD_LINE }}
          STYLE: line
          CSS_PREFIX: uil
      - name: Download Solid Icons
        run: npm run line:download
        env:
          API_DOWNLOAD_SOLID: ${{ secrets.API_DOWNLOAD_SOLID }}
          STYLE: solid
          CSS_PREFIX: uis
      - name: Download Monochrome Icons
        run: npm run monochrome:download
        env:
          API_DOWNLOAD_MONOCHROME: ${{ secrets.API_DOWNLOAD_MONOCHROME }}
      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          title: Updated Icons
tarunmangukiya commented 3 years ago

This is working good for PRs I think. I'll ping if there's any issue.