Skip to content

Checkout not checking out to PR branch #1325

Open
@Lucasmiguelmac

Description

@Lucasmiguelmac

Let's say I have a dev target branch and I want to set up a GH Action .yml file to run on every PR.

The first step,that is, the actions/checkout@v2 step, is no longer doing what it's supposed to. Which would be: checking out to the branch I'm wanting to merge.

name: Run tests
on:
  pull_request:
    types: [opened, reopened, synchronize]
jobs:
  trigger-job:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 
        uses: actions/checkout@v2
      - name: Print current branch
        run: echo "$(git branch)" # --> echoes "(HEAD detached at pull/<pr-number>/merge)"

For demonstration purposes:

  1. I attach a side by side comparisson of the same pipeline run with a 4 days difference
    image
  2. I tried the same on another non related GH user and had the same error

Why is that? The same Print current branch step would print the actual name of the branch I'm trying to merge into dev a couple of days ago, but not anymore

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