Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix secret passing in release workflows #189

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

cwaldren-ld
Copy link
Contributor

Didn't realize that reusable workflows need a special syntax for passing secrets like GITHUB_TOKEN, different than inputs.

The existing config results in an invalid workflow file (although it works fine in act.)

Copy link

This pull request has been linked to Shortcut Story #233949: Swap sdk-test-harness to Github Actions.

@cwaldren-ld cwaldren-ld marked this pull request as ready for review February 21, 2024 18:30
tag: ${{ inputs.tag }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it is a workflow, instead of a composite, you shouldn't need to pass. The workflow can have its own permissions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a reusable workflow is triggered by a caller workflow, the github context is always associated with the caller workflow. The called workflow is automatically granted access to github.token and secrets.GITHUB_TOKEN. For more information about the github context, see "[Contexts](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context)."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflows have a greater trust level than a composite, as they aren't really meant to come from external sources like a composite.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I see that secrets is automatically available. This does work though, but I'll refactor to remove it.

@cwaldren-ld cwaldren-ld merged commit be3e5ec into v2 Feb 21, 2024
3 of 4 checks passed
@cwaldren-ld cwaldren-ld deleted the cw/sc-233949/workflow-syntax-release-please branch February 21, 2024 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants