Skip to content

Allow container building on forks#570

Open
the-mentor wants to merge 1 commit intoterrateamio:mainfrom
the-mentor:allow-container-building-on-forks
Open

Allow container building on forks#570
the-mentor wants to merge 1 commit intoterrateamio:mainfrom
the-mentor:allow-container-building-on-forks

Conversation

@the-mentor
Copy link
Copy Markdown
Contributor

I modified the workflows to use the ${{ github.repository }} variable to allow building and publishing on forks.

Also I replaced the hardcoded v1 with ${{ github.ref_name }} which is the branch name.
Since the trigger for the ci workflow is a push to the v1 branch in the future we can add v2 and we wont have to modify the workflow to support the v2 tag.

@the-mentor the-mentor requested a review from a team as a code owner March 5, 2026 11:45
@the-mentor the-mentor changed the title Allow container building on forks by using the GitHub repository variable Allow container building on forks Mar 5, 2026
@the-mentor the-mentor force-pushed the allow-container-building-on-forks branch from f7fdc39 to 60e1a20 Compare March 5, 2026 12:30
@the-mentor the-mentor force-pushed the allow-container-building-on-forks branch from 60e1a20 to 7b89adb Compare March 5, 2026 12:31
Comment on lines -32 to +37
tags: ghcr.io/terrateamio/action:v1
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@joshpollara @orbitz> this one to verify

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tamiyasigmar per the code env.REGISTRY is ghcr.io and {{ github.repository }} is a system variable for the github repository so for tearrateam it will be terrateamio/action and for my fork it will be the-mentor/action and so on

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@the-mentor> what about github.ref_name? This is the part that looks like the actual change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tamiyasigmar github.ref_name is the name of the branch.
so if you build the action on a branch called v1 the image tag will be v1 if you build it on a branch called v2 the tag will be v2 its a better approach then hard coding the branch name

@the-mentor
Copy link
Copy Markdown
Contributor Author

@tamiyasigmar @orbitz Is there anything else this PR needs?

@marcinkubica
Copy link
Copy Markdown

I suppose removing dependency on docker action and refactor to composite would be the real fix. It's kind of sensible nowadays, see https://github.com/gruntwork-io/terragrunt-action

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