Skip to content

Pull requests containing change to git submodule can't be signed #3353

Closed

Description

@gizmoguy

Subject of the issue

If a pull request raised by this action contains a change to a git submodule when commit signing is enabled, an error occurs and the pull request is not created.

I think the error is caused here, where the action attempts to read the submodule directory to convert it to base64:

https://github.com/peter-evans/create-pull-request/blob/main/src/github-helper.ts#L265

Steps to reproduce

Here is a github action workflow which repros the issue:

---
name: Create pull request

on:
  workflow_dispatch:

jobs:
  create-pull-request:
    name: Create pull request with submodule
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Add git submodule
        run: |
          git submodule add https://github.com/actions/starter-workflows

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v7
        with:
          sign-commits: true

You can see the output of a failed run of this workflow here:

https://github.com/gizmoguy/create-pull-request-signed-test/actions/runs/10912635430/job/30287661070

The error is this:

Pushing pull request branch to 'origin/create-pull-request/patch'
  /usr/bin/git stash push --include-untracked
  Ignoring path starter-workflows/
  Saved working directory and index state WIP on main: 4ae0eb8 Add create pull request workflow
  /usr/bin/git checkout --progress create-pull-request/patch --
  Switched to branch 'create-pull-request/patch'
  Your branch and 'origin/create-pull-request/patch' have diverged,
  and have 2 and 6 different commits each, respectively.
    (use "git pull" if you want to integrate the remote branch with yours)
  Creating tree objects for local commit f1f261260ae4df8ac52497d66b9daa2d303f925b
  Error: Error creating blob for file 'starter-workflows': EISDIR: illegal operation on a directory, read
  Error: EISDIR: illegal operation on a directory, read

Activity

  1. peter-evans commented on Sep 18, 2024

    @peter-evans
    Owner

    Hi @gizmoguy

    Thank you for raising this issue and providing clear info on how to reproduce it! I'll take a look at how to fix this.

  2. peter-evans commented on Sep 18, 2024

    @peter-evans
    Owner

    Released a fix for this in v7.0.4 / v7

    Thanks again!

  3. gizmoguy commented on Sep 18, 2024

    @gizmoguy
    Author

    Can confirm that I'm able to now sign commits that contain submodules, thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions