Forum Discussion

mike99's avatar
mike99
Occasional Contributor
2 years ago

Reading attached files in "load-secrets-action@v2" GitHub Actions

Hello,

We've recently started using 1Password as a secret provider for GitHub Actions with the custom action at https://github.com/1Password/load-secrets-action

We can successfully read text values from "Password" items and it works great, but I'm not sure if or how we can read the contents of attached files.

For example, I have a file called "my-key.pem" attached to a Password-type item called "my-password-item". In the GitHub Actions I can read other fields in the same item fine with this:


- name: load secrets
id: onepassword
uses: 1password/load-secrets-action@v2
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: "${{ secrets.ONEPASSWORD_TOKEN }}"
SOME_VALUE: "op://my-vault/my-password-item/some_value"

but if I add this to the "env" list:


MY_KEY: "op://my-vault/my-password-item/my-key.pem"

I get an error from the "load secrets" step as follows:


Error: could not read secret 'op://my-vault/my-password-item/my-key.pem': item 'op://my-vault/my-password-item' does not have a field 'my-key.pem'

Am I doing something wrong, or are file attachments not supported? I couldn't find anything conclusive either way in the documentation at https://developer.1password.com/docs/ci-cd/github-actions/

Thanks,

Mike


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided

No RepliesBe the first to reply