Skip to content

Commit

Permalink
Log GH event when tagging master (#16076)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraham authored and gsnedders committed Mar 26, 2019
1 parent 540b98c commit a960bba
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tools/ci/tag_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,21 @@ def create_release(owner, repo, sha, tag, summary, body):
def should_run_action():
with open(os.environ["GITHUB_EVENT_PATH"]) as f:
event = json.load(f)
logger.info(json.dumps(event, indent=2))

if "pull_request" in event:
logger.info("Not tagging for PR")
return False
if event.get("ref") != "refs/heads/master":
logger.info("Not tagging for non-master branch")
logger.info("Not tagging for ref %s" % event.get("ref"))
return False
return True


def main():
repo_key = "GITHUB_REPOSITORY"
should_run = should_run_action()

if not should_run:
logger.info("Not tagging master for this push")
if not should_run_action():
return

owner, repo = os.environ[repo_key].split("/", 1)
Expand Down

0 comments on commit a960bba

Please sign in to comment.