Skip to content

PULL_REQUEST_TEMPLATE.md fails files_unchanged linting test depending on local choice of default branch #3423

@alexlyttle

Description

@alexlyttle

Description of the bug

Context

It appears a recent update to PULL_REQUEST_TEMPLATE.md takes whatever the git init default branch is set to locally when building from the template. Working on a pipeline for a non-nf-core organisation, I performed a manual sync on my device (nf-core v3.1.2). Then, nf-core pipelines lint passed when I ran it locally. However, the linting.yml action workflow failed on GitHub with

╭─ [✗] 1 Pipeline Test Failed ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                                  │
│ files_unchanged: .github/PULL_REQUEST_TEMPLATE.md does not match the template                                                                                                    │
│                                                                                                                                                                                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

On my device, I have set my default git branch to main with git config --global init.defaultBranch main. It appears the template takes this into account when creating PULL_REQUEST_TEMPLATE.md. However, the linting.yml GitHub Actions environment default git branch is master. When I set git config --global init.defaultBranch master locally and reran nf-core pipelines lint, I could reproduce the above error. I then ran again with --fix files_unchanged, pushed the changes, and the GitHub Action workflow succeeded.

Problems

  1. nf-core pipelines lint will fail when run on a device where git config --global init.defaultBranch is set to anything other than the value used when creating PULL_REQUEST_TEMPLATE.md from the template

  2. The linting.yml workflow will fail if the default branch set when creating PULL_REQUEST_TEMPLATE.md is anything other than master

Solution

Use the GitHub API to get the default_branch for the pipeline when creating the template (e.g. see here)

Command used and terminal output

Go to any pipeline on your machine and run


git config --global init.defaultBranch anything-different


then run,


nf-core pipelines lint

System information

  • nf-core/tools v3.1.2
  • macOS, Ubuntu Linux
  • Python 3.10, 3.11, 3.12
  • Nextflow 24.04, 24.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions