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

Look before leaping #8292

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Look before leaping #8292

wants to merge 4 commits into from

Conversation

jsoref
Copy link
Contributor

@jsoref jsoref commented May 31, 2024

Discussion

#8274
#8275 (comment)

Testing

Yes

API Changes

@jsoref jsoref requested a review from a team as a code owner May 31, 2024 20:59
Copy link

changeset-bot bot commented May 31, 2024

⚠️ No Changeset found

Latest commit: f74376c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@dlarocque dlarocque left a comment

Choose a reason for hiding this comment

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

Is there a way we can perform this check without adding noise to our already long workflow file?

@jsoref
Copy link
Contributor Author

jsoref commented Jun 2, 2024

It's possible you don't need to check all of these inputs.

If the programs can be changed to not die if the variables are missing, then this kind of stuff wouldn't be necessary.

But, generally GitHub workflows don't expose secrets to if, so you do kinda need to expose something if the called programs will die when missing environment variables.

You can manipulate the env setting to produce a single HAS_ALL_REQUIRED_SECRETS: ${{ (secrets.x != '') && ... && 1 || 0 }} or something like that...
And then if: env.HAS_ALL_REQUIRED_SECRETS }}

@dlarocque
Copy link
Contributor

It's possible you don't need to check all of these inputs.

If the programs can be changed to not die if the variables are missing, then this kind of stuff wouldn't be necessary.

But, generally GitHub workflows don't expose secrets to if, so you do kinda need to expose something if the called programs will die when missing environment variables.

You can manipulate the env setting to produce a single HAS_ALL_REQUIRED_SECRETS: ${{ (secrets.x != '') && ... && 1 || 0 }} or something like that...
And then if: env.HAS_ALL_REQUIRED_SECRETS }}

I see, so there doesn't seem like a cleaner alternative.
Are there any reasons why we'd want to add these checks aside from being able to run them in forks? These are all release workflows that should never be ran in forks.

@jsoref
Copy link
Contributor Author

jsoref commented Jun 2, 2024

You could simplify to if: github.repository == '... '.

But that'd make it harder for an external to contribute patches.

@dlarocque
Copy link
Contributor

dlarocque commented Jun 4, 2024

You could simplify to if: github.repository == '... '.

But that'd make it harder for an external to contribute patches.

Since these workflows are only used by our team and should never be ran on forks, I don't think this makes it harder for anyone external to contribute.

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