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

Use reusable workflows #2

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

Conversation

mderriey
Copy link
Collaborator

CarterCommunity/Carter#311

Instead of copying the workflow file around, this sets us up to use reusable workflows, where a workflow can call another another one, even if it's defined in another repository.

In our case, this means the following:

  • The logic to update Carter NuGet package references lives in a workflow in this repository.
  • In all the other repos where we need to do this, we can add a workflow that "just" calls the one mentioned above.
  • If we need to make adjustments to the logic, we can do it once in this repository.

One aspect that is not ideal is that we (based on my suggestion) named this repository .github, and GitHub expects workflow files to live in the .github/workflows directory.
This means that, in the other repos, when we want to call the workflow in this repository, we'll have a double .github segment in the path, which may look weird and/or confuse people:

jobs:
  update-carter-package-references:
    # <org>/<repo>/.github/workflows/<workflow-name>.yml
    uses: CarterCommunity/.github/.github/workflows/update-carter-package-references.yml@main
    with:
      includePrerelease: ${{ github.event.inputs.includePrerelease }}
      commitAndPush: ${{ github.event.inputs.commitAndPush }}

If we don't like this, I think it's easy enough to create another repo that we can call reusable-workflows or something along those lines, and get rid of this one.

Up to you.

@jchannon
Copy link
Member

Could we just rename this repo or dos that have a conflict with other stuff?

@mderriey
Copy link
Collaborator Author

I didn't know renaming repos was an option, that's great.

No dependency so far on the repo name, go ahead and I'll update this PR accordingly.

Thanks!

@jchannon
Copy link
Member

All done 🙂

@mderriey
Copy link
Collaborator Author

All good from my side now.

As an aside, I couldn't find another repo with projects taking a NuGet dependency on Carter, they all seem to use Git submodules. Do we plan on changing this?

@mderriey
Copy link
Collaborator Author

Thanks, I pushed an update that points to the right repository.

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