2

A step in my workflow file will return some IDs of EC2 instances in my aws account and then i set these IDs as a github output to be used in other jobs in my workflow file

I have done this in many workflows and step will return something like this:

["i-0d945b001544f2614","i-0b90ba69d37aad78c"]

However, in one workflow file github is masking the IDs as it thinks it is a secret for some reason, so it will return:

["i-***2d571abc6d7d***4ef","i-***186ce12c5cd8e744"]

Therefore i get this error message on the workflow job summary:

Skip output 'instanceIDs' since it may contain secret.

And so the other jobs in my workflow file that rely on this output will fail as github won't set an output.

I have tried to use base64 as suggested in this post but i haven't been able to get that to work

Is there any other work around?

polo
  • 155
  • 4
  • 11
  • You are in luck, you need to replace your secrets with variables: https://github.blog/changelog/2023-01-10-github-actions-support-for-configuration-variables-in-workflows/ – aknosis Jan 10 '23 at 19:34
  • @aknosis if you don't mind, I posted an answer based on the link you've shared :) It may be useful for others who will search for a solution in similar cases – Andrii Bodnar Jan 11 '23 at 17:28
  • @aknosis - thanks! very lucky timing! – polo Jan 21 '23 at 22:28

1 Answers1

2

Recently, GitHub released a new feature - configuration variables in workflows.

Configuration variables allow you to store your non sensitive data as plain text variables that can be reused across your workflows in your repository or organization.

You can define variables at Organization, Repository, or Environment level based on your requirement.

These variables are accessible from the workflow by vars context.

Example:

jobs:
  display-variables:
    runs-on: ${{ vars.RUNNER }}
    steps:
    - name: Use variables
      run: |
        echo "Repository variable : ${{ vars.REPOSITORY_VAR }}"
        echo "Organization variable : ${{ vars.ORGANIZATION_VAR }}"

In this example, we have the following configuration variables: RUNNER, REPOSITORY_VAR, ORGANIZATION_VAR. As opposed to the repository secrets, the values of these variables won't be masked.

For more details, see the Defining configuration variables for multiple workflows.

Andrii Bodnar
  • 1,672
  • 2
  • 17
  • 24