Skip to content

Conversation

@alexandrevicenzi
Copy link
Member

If not, skip the build as the job will fail

If not, skip the build as the job will fail
@alexandrevicenzi
Copy link
Member Author

This change makes it clear why PRs from forks fail to run.

echo "have-secrets=true" >> $GITHUB_OUTPUT
else
echo "❌ Missing required secrets: ${missing[*]}"
echo "⚠️ PRs must be sent from branches, not forks!"
Copy link
Member

Choose a reason for hiding this comment

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

this is slightly contradicting. either we tell people to set the secrets (which they could on forks) or we forbid running from forks. that would be simpler to achieve:

  if [ ${{github.repository }} ] != "SUSE/BCI-dockerfile-generator" ]; then

Copy link
Member Author

Choose a reason for hiding this comment

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

You could run on a fork if you have the proper secrets. It is possible to share secrets with forks, but this is security issue, so a no-go IMHO.

Not everyone can create a branch to send a PR, so yes, the message does not help much.

We could skip the run instead of failing with an error, not sure what is the best user experience here.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think anyone has the right secrets (or we shouldn't advertise people putting their OSC access tokens into github, far too dangerous).

I suggest to only go with the "check if it is a fork, then don't run the jobs" approach instead. this doesn't advertise contributors to do an unsafe operation.

obs-build:
needs: check-secrets
if: needs.check-secrets.outputs.have-secrets == 'true'
Copy link
Member

Choose a reason for hiding this comment

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

I think the needs alone causes it to be skipped so the if should be unnecessary? haven't tested it though.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, the if might be removed if we dont write the file on failures perhaps, because we current write a value and read the value.

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.

3 participants