cirrus-actions / rebase

GitHub Action to automatically rebase PRs
MIT License
686 stars 138 forks source link

Checkout repo in a custom path #82

Closed antho-girard closed 3 years ago

antho-girard commented 3 years ago

Hi,

The actions/checkout action allows specifying a relative path.

But, by doing so the rebase fails and we get this error : fatal: not a git repository (or any parent up to mount point /github)

Is there a workaround? (I tried to add a step cd some/custom/path before rebasing but I got the same error)

Here is the workflow file :

name: Automatic Rebase
on:
  issue_comment:
    types: [created]
jobs:
  rebase:
    name: Rebase
    if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
    runs-on: ubuntu-latest
    steps:
      - name: Checkout the latest code
        uses: actions/checkout@v2
        with:
          path: some/custom/path
          token: ${{ secrets.GITHUB_TOKEN }}
          fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
      - name: Automatic Rebase
        uses: cirrus-actions/rebase@1.4
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Thanks!

fkorotkov commented 3 years ago

Will changing working directory for the whole action work for your use case?

jobs:
  phpunit:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./app
antho-girard commented 3 years ago

It did seem to work :/

So I ended up keeping the default working directory and using another workflow with personal access token.

Thanks for help

mbergal commented 3 years ago

Well, I think this does not work - working-directory is not applicable to custom actions.