Skip to content

Commit signing doesn't work with non-RSA keys #295

@thusoy

Description

@thusoy

Describe the bug
When setting gpg_private_key to a non-RSA key, it fails to be picked up by the action since it only searches for the rsa\d+ prefix of the key. The key type is filtered here.

To Reproduce
Steps to reproduce the behavior:

  1. Create a gpg key with ed25519 or nistp384 key types and add to repo secrets.
  2. Include this in your workflow:
- name: Download translations from Crowdin
        uses: crowdin/github-action@v2
        with:
          upload_sources: false
          download_translations: true
          create_pull_request: true
          gpg_private_key: ${{ secrets.CI_USER_CROWDIN_GPG_KEY }}
          gpg_passphrase: '' # Not encrypted, passphrase would be distributed the same way as the key so doesn't add any practical benefits
          github_user_name: some name
          github_user_email: email that matches key
        env:
          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expected behavior
Commit signing works.

Additional context
This is the error output:

FOUND PRIVATE KEY, WILL SETUP GPG KEYSTORE
gpg: directory '/github/home/.gnupg' created
gpg: /github/home/.gnupg/trustdb.gpg: trustdb created
gpg: key 7852AE445F33F9D6: public key "<ci and email>" imported
gpg: key 7852AE445F33F9D6: secret key imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg:       secret keys read: 1
gpg:   secret keys imported: 1
Imported key information:
      Key id: 
  Owner name: <ci name>
 Owner email: <ci-email>
CONFIGURING GIT USER
M	<file-path-removed>
Already on 'crowdin-gpg-key'
<files-changed-removed>
Your branch is up to date with 'origin/crowdin-gpg-key'.
Switched to a new branch 'l10n_crowdin_action'
PUSH TO BRANCH l10n_crowdin_action
error: gpg failed to sign the data:
gpg: skipped "": Invalid user ID
[GNUPG:] INV_SGNR 0 
[GNUPG:] FAILURE sign 37
gpg: signing failed: Invalid user ID

fatal: failed to write commit object

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions