Skip to content

Only run our workflows on the aerius repository - #29

Open
JornC wants to merge 2 commits into
aerius:mainfrom
JornC:push-event-main-only
Open

JornC wants to merge 2 commits into
aerius:mainfrom
JornC:push-event-main-only

Conversation

@JornC

@JornC JornC commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

This is part of a round of mass gha workflow refinements, where up to 2 rules are applied:

  • Rule 1: a workflow only runs when the repository is aerius/tools
  • Rule 2: a push workflow only triggers on main and the *_fixes branches

For this repo:

Rule 1 is applied to on-code-push.yml (already in this PR), create-release.yml, on-new-tag.yml and on-pull_request-opened-synchronize-reopened.yml
Rule 2 has already been applied


LLM-generated technical summary

A job-level if: github.repository == 'aerius/tools' stops the job in any fork while leaving behavior in the canonical repo unchanged. It is deliberately at job level rather than inside the shared composite actions in aerius/github-actions: a composite action has no on: block and can only gate individual steps, so a central version would still spin up the runner and run a full build before declining to publish.

On a pull_request event github.repository is the base repository, so the guard is false only when the PR's base is itself a fork. A PR from a fork into the canonical repo is unaffected.

Note for anyone rehearsing a release in their own fork: a guarded job skips silently rather than failing, so the if: line has to come out locally first.

@JornC
JornC requested a review from SerhatG July 21, 2026 12:13
@SerhatG

SerhatG commented Jul 21, 2026

Copy link
Copy Markdown
Member

We usually just disable actions fully on our own fork. The check for the repo would work as well, but means we need to do it for all repo's one by one. I might prefer to do it in the github-actions instead then (check for aerius/*).

The main repo means it won't work for release branches (which for aerius/tools is not an issue - but will be for other repo's if it would be copied over)

@JornC

JornC commented Jul 21, 2026 •

Copy link
Copy Markdown
Member Author

@SerhatG I don't think doing this for all repo's one by one (especially library-ish repos like this one) is the wrong thing to do here tbh.

Especially for stuff that publishes to some external thing, we should design what/when/where things are executed, instead of lean implicitly on whether a fork's gh action checkbox is turned on or off

FWIW the repo/branch guard is standard in the guideline:

https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-jobs-with-conditions

@JornC

JornC commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

On a more general note I don't think everything that happens in a github action needs to be flexibly provided by the top layer github actions wrapper either; there is room for custom considerations, such as whether the action is executed on this or that branch or remote or whatever

The code-push workflow deploys a -SNAPSHOT to the internal Nexus, which
needs the NEXUS_* secrets. Forks do not have those, so any fork push that
matches the branch filter fails on the deploy step.

Guard the job on the repository so it only runs on aerius/tools.
@JornC
JornC force-pushed the push-event-main-only branch from 07db003 to d33e74a Compare August 10, 2026 08:14
@JornC JornC changed the title Only run push-event on the canonical repo's main branch Only run code-push on the canonical repo Aug 10, 2026
The tag, pull_request and create-release workflows can run in a fork too.
Same rule in every file, so it is not something to reason about per event.
@JornC JornC changed the title Only run code-push on the canonical repo Only run our workflows on the aerius repository Aug 26, 2026
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