1Password / load-secrets-action

Load secrets from 1Password into your GitHub Actions jobs
https://developer.1password.com
MIT License
190 stars 25 forks source link

The doc from 1Password Developer is not up-to-date with latest load-secrets-action #47

Closed cychiang closed 1 year ago

cychiang commented 1 year ago

Background

I followed the instruction from the official docs to work on the CI/CD integration but failed to get actions output. After a while I figured it out I should set export-env: false to enable the actions output because by default the value of the export-env is true even is not set. This behaviour is noted in the load-secrets-action repository but not the official document.

The official docs for CI/CD integration should make a change to adopt the latest version of load-secrets-action

There is no report channel to submit a fix to the official doc so I open a issue here to suggest a change to prevent a scenario where we get unexpected output from the code example.

Change Proposal

The code example for use secrets from the actions output in official docs should make an update and explicitly set export-env: false to enable the action's output feature as following so we can get the expected result as code example.

on: push
jobs:
  hello-world:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Load secret
        id: op-load-secret
        uses: 1password/load-secrets-action@v1
        with: 
          export-env: false
        env:
          OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
          SECRET: op://app-cicd/hello-world/secret

      - name: Print masked secret
        run: echo "Secret: ${{ steps.op-load-secret.outputs.SECRET }}"
        # Prints: Secret: ***
edif2008 commented 1 year ago

Thank you for reporting this.

I've raised it with the team and we should fix it on the Developer Portal pretty soon. 😄

edif2008 commented 1 year ago

The documentation has been updated. Now the snippets should be accurate. 😄