Skip to content

How to checkout current PR branch? #1108

Open
@wolf99

Description

@wolf99

I am trying to create a PR workflow that checkouts out the PR branch, lints the markdown, and then makes a commit with the changes (on PR: google/osv-scanner#144).

This is running on the PR branch that is introducing this workflow, which is coming from my fork of this repo.

I am not understanding how to properly checkout the PR branch.

Looking at #20, and the docs for the Prettier action I am using for linting, it seems I should just

- uses: actions/checkout
  with:
    ref: ${{ github.ref }}

But using this causes checkout to fail, see job: https://github.com/google/osv-scanner/actions/runs/3914565858/jobs/6691777605

Fetching the repository
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/prettier-lint-md-workflow*:refs/remotes/origin/prettier-lint-md-workflow* +refs/tags/prettier-lint-md-workflow*:refs/tags/prettier-lint-md-workflow*
  The process '/usr/bin/git' failed with exit code 1
  Waiting 13 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/prettier-lint-md-workflow*:refs/remotes/origin/prettier-lint-md-workflow* +refs/tags/prettier-lint-md-workflow*:refs/tags/prettier-lint-md-workflow*
  The process '/usr/bin/git' failed with exit code 1
  Waiting 15 seconds before trying again
  /usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +refs/heads/prettier-lint-md-workflow*:refs/remotes/origin/prettier-lint-md-workflow* +refs/tags/prettier-lint-md-workflow*:refs/tags/prettier-lint-md-workflow*
  Error: The process '/usr/bin/git' failed with exit code 1

My git-fu 🥷 isn't strong enough to figure out what is wrong here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions