Skip to content

Commit 22c7154

Browse files
Limit Github Actions packaging job to only run on main repo
Currently, the github action that does a scheduled publish of the package tries to run on all forks (or at least mine) when it is present in the main branch. This isn't desirable as even though nothing will actually get pushed to PyPI as the repository secrets aren't present, even just trying it will cause a notification for a failed job to be sent at 00:00 UTC every day. This patch fixes that behavior by restricting the twine upload step to only run on the main branch in the google/ml-compiler-opt repo (i.e., no forks) as Github doesn't seem to have better controls to enforce this sort of behavior.
1 parent 56fbf33 commit 22c7154

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

.github/workflows/packaging.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ jobs:
2828
TWINE_USERNAME: __token__
2929
TWINE_PASSWORD: ${{secrets.PYPI_TOKEN}}
3030
name: Publish the package
31+
if: ${{github.repository_owner == 'google' && github.ref_name == 'main'}}

0 commit comments

Comments
 (0)