Skip to content

Commit

Permalink
Only push if env.PROD is set
Browse files Browse the repository at this point in the history
  • Loading branch information
dhinakg committed Jan 3, 2023
1 parent 8bd80fd commit 8bbbd01
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Build
on:
push:
branches:
- github-actions
schedule:
- cron: '*/5 * * * *'
workflow_dispatch:
Expand All @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions add.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import datetime
import hashlib
import json
import os
import time
from pathlib import Path

Expand Down Expand Up @@ -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
12 changes: 7 additions & 5 deletions update_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copy
import json
import os
import sys
import urllib.parse
from pathlib import Path
Expand Down Expand Up @@ -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()
12 changes: 7 additions & 5 deletions updater.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import json
import os
import sys
import traceback
from pathlib import Path
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 8bbbd01

Please sign in to comment.