Skip to content

Conversation

@gep13
Copy link
Member

@gep13 gep13 commented Oct 30, 2025

Warning

This will not work until we use at least version 1.1.0 of Cake :-(

Description Of Changes

This commit adds a new property called IsOriginalRepository, which tries to ensure that the original
repository, and not a fork of the repository is being used. In TeamCity, we have to go and "find" this information
and we may need to surface it in a slightly different way, so that it can be agnostic across build providers, but
for now, this has come to a bit of a halt, since the BuildProperties property doesn't exist in the version of Cake
that we are currently using.

Motivation and Context

We need a way to prevent certain parts of the build from executing, when it is being run on a fork
of the original repository. We can get this information from TeamCity via the BuildProperties collection
but we may need to find other locations of this information from the other build providers.

Testing

None, yet.

Operating Systems Testing

  • Windows 11

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v3 compatibility checked?

Related Issue

Fixes #23

This will not work until we use at least version 1.1.0 of Cake :-(
@gep13 gep13 changed the title WIP Add check for IsOriginalRepository Oct 31, 2025
@gep13
Copy link
Member Author

gep13 commented Oct 31, 2025

@corbob @AdmiringWorm curious for thoughts on naming here...

Before, we had IsMainRepository, which was borrowed from Cake.Recipe, but I am not sure I like that, so in this draft PR, I changed to IsOriginalRepository, but I am also not sure that I like that. Another thought was IsSourceRepository, but I am not sure if the intention is clear there.

Thoughts on other suggestions for this? Thanks!

@AdmiringWorm
Copy link
Member

AdmiringWorm commented Oct 31, 2025

@gep13 since we very often call the original repository for an upstream source, maybe IsUpstreamRepository?

@corbob
Copy link
Member

corbob commented Oct 31, 2025

Before, we had IsMainRepository, which was borrowed from Cake.Recipe, but I am not sure I like that, so in this draft PR, I changed to IsOriginalRepository, but I am also not sure that I like that. Another thought was IsSourceRepository, but I am not sure if the intention is clear there.

So if I'm understanding the intention, using chocolatey/choco as an example, we're wanting to know if we're running this against chocolatey/choco vs corbob/choco... In the chocolatey/choco case this is set to true, and in corbob/choco this is false... So we're wanting to know if we're not on a forked repo. But IMHO IsNotForkedRepository while being more descriptive of that is a negative... and IsForkedRepository while not being a negative, we would be negating it to determine how we should act... Part of me wanted to say IsUpstreamRepository, but that I think is coming to the same troubles that IsMainRepository and IsOriginalRepository have, it's relying on someone knowing the upstream vs origin nomenclature.

@gep13
Copy link
Member Author

gep13 commented Nov 1, 2025

@corbob said...
So if I'm understanding the intention, using chocolatey/choco as an example, we're wanting to know if we're running this against chocolatey/choco vs corbob/choco... In the chocolatey/choco case this is set to true, and in corbob/choco this is false... So we're wanting to know if we're not on a forked repo.

That is exactly correct.

I actually quite like IsForkedRepository, that is a great suggestion!

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.

Add check for IsMainRepository

3 participants