diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index 61553cb748..664d5a8e30 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -1,8 +1,6 @@ name: Build on: push: - branches: - - github-actions schedule: - cron: '*/5 * * * *' workflow_dispatch: @@ -13,6 +11,7 @@ env: ACID32: 1 HOMEBREW_NO_INSTALL_CLEANUP: 1 HOMEBREW_NO_AUTO_UPDATE: 1 + PROD: ${{ github.ref == 'refs/heads/github-actions' }} concurrency: group: ${{ github.workflow }} jobs: diff --git a/add.py b/add.py index f051a55ded..df85dcfc7f 100644 --- a/add.py +++ b/add.py @@ -1,6 +1,7 @@ import datetime import hashlib import json +import os import time from pathlib import Path @@ -158,9 +159,10 @@ def add_built(plugin, token): config[name]["versions"].sort(key=lambda x: (x["date_committed"], x["date_authored"]), reverse=True) save_config(config) - repo = git.Repo(script_dir / Path("Config")) - repo.git.add(all=True) - repo.git.commit(message="Deploying to builds") - repo.git.push() + if os.environ.get("PROD"): + repo = git.Repo(script_dir / Path("Config")) + repo.git.add(all=True) + repo.git.commit(message="Deploying to builds") + repo.git.push() return release diff --git a/update_config.py b/update_config.py index d48b608da9..6c6fdd9602 100644 --- a/update_config.py +++ b/update_config.py @@ -1,5 +1,6 @@ import copy import json +import os import sys import urllib.parse from pathlib import Path @@ -66,8 +67,9 @@ def add_author_date(name, version): save_config(config) -repo = git.Repo("Config") -if repo.is_dirty(untracked_files=True): - repo.git.add(all=True) - repo.git.commit(message="Deploying to builds") - repo.git.push() +if os.environ.get("PROD"): + repo = git.Repo("Config") + if repo.is_dirty(untracked_files=True): + repo.git.add(all=True) + repo.git.commit(message="Deploying to builds") + repo.git.push() diff --git a/updater.py b/updater.py index 523a0baf6d..b3634dd21c 100644 --- a/updater.py +++ b/updater.py @@ -1,5 +1,6 @@ import datetime import json +import os import sys import traceback from pathlib import Path @@ -197,11 +198,12 @@ def add_to_failures(plugin): json.dump(failures, (config_dir / Path("failures.json")).open("w"), indent=2, sort_keys=True) -repo = git.Repo(config_dir) -if repo.is_dirty(untracked_files=True): - repo.git.add(all=True) - repo.git.commit(message="Deploying to builds") - repo.git.push() +if os.environ.get("PROD"): + repo = git.Repo("Config") + if repo.is_dirty(untracked_files=True): + repo.git.add(all=True) + repo.git.commit(message="Deploying to builds") + repo.git.push() if len(failed) > 0 or len(errored) > 0: