Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gizmoguy opened this issue Sep 17, 2024 · 3 comments · Fixed by #3354
Closed

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

gizmoguy opened this issue Sep 17, 2024 · 3 comments · Fixed by #3354

Comments

@gizmoguy
Copy link

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
@peter-evans
Copy link
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.

@peter-evans
Copy link
Owner

Released a fix for this in v7.0.4 / v7

Thanks again!

@gizmoguy
Copy link
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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants