Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
twoellert
11 months agoNew Contributor
CLI Bug - Item edit fails from within GitHub Action
Hey,
I noticed a bug in the 1password CLI if you use it from within a GitHub Action. The issue occurs when editing an existing item in a 1password vault.
Command to call from within a GitHub Ac...
dbsmith
4 months agoNew Contributor
Still broken in 1Password CLI v2.31.0.
The proposed workaround doesn't work for me when attempting to edit a secure note or API credential item.
Relevant step in GitHub Actions is:
- name: Get Tailscale auth key (Client) from 1Password
id: get-tailscale-authkey-1password-client
run: |
op item get $OP_ITEM_ID --vault $OP_VAULT_ID --format json > $OP_ITEM_ID.json
jq --arg field_id "$OP_FIELD_ID" --arg new_value "$TAILSCALE_AUTHKEY_CLIENT" '.fields |= map(if .id == $field_id then .value = $new_value else . end)' $OP_ITEM_ID.json > $OP_ITEM_ID.updated.json
env:
OP_ITEM_ID: 'REDACTED'
OP_FIELD_ID: 'credential'
TAILSCALE_AUTHKEY_CLIENT: 'clientclientclient'
- name: Save Tailscale auth key (Client) to 1Password
id: save-tailscale-authkey-1password-client
run: |
cat $OP_ITEM_ID.updated.json | op item edit $OP_ITEM_ID --vault $OP_VAULT_ID
env:
OP_ITEM_ID: 'REDACTED'
OP_VAULT_ID: 'REDACTED'
Note that if I cat the updated JSON to stdout it shows that the file was correctly updated, so the issue should not be the JSON file but rather with updating the 1Password entry afterwards.
Error in the save step in GitHub Actions is:
unable to process line 1: Couldn't update the item.
dbsmith
4 months agoNew Contributor
Embarrassed to admit that the workaround DOES, in fact, work, and my service account simply lacked write permissions. Would love for the error message to tell me this, but it was my error and I have my action working now!