Merge pull request #12 from JayFoxRox/no-update

Don't auto-update
This commit is contained in:
James Rowe 2016-11-25 12:35:43 -07:00 committed by GitHub
commit 499acc800b
2 changed files with 2 additions and 15 deletions

View File

@ -12,7 +12,7 @@ It is ran on a daily cron-job and updates from this repo before trying to merge
## What does it do? ## What does it do?
After doing the self-update, the bot will clone the latest `MAIN_REPO` and resync `PUSH_REPO`/master. The bot will clone the latest `MAIN_REPO` and resync `PUSH_REPO`/master.
After that, each of the `PULL_REPOS` is visited. After that, each of the `PULL_REPOS` is visited.
It will look for PRs on GitHub labelled with `LABEL_TO_FETCH` and merge those onto the `MAIN_REPO`/master branch. It will look for PRs on GitHub labelled with `LABEL_TO_FETCH` and merge those onto the `MAIN_REPO`/master branch.
If a PR fails to merge it will be ignored. If a PR fails to merge it will be ignored.
@ -25,10 +25,8 @@ The default configuration is to log to *debug.log*, *error.log* and stdout.
## Installation ## Installation
Clone this repo and configure lemonbot by modifying the configuration in *tag_build.py*. Download *tag_build.py* and configure lemonbot by modifying the configuration at the top of the file.
You can then run the script. You can then run the script.
Note that the script depends on being part of a git repo.
The script uses `git pull origin master` to update itself.
## License ## License

View File

@ -185,18 +185,7 @@ def handleRemoveReadonly(func, path, exc):
if __name__ == "__main__": if __name__ == "__main__":
logger.info("=== Starting build at {date} ===".format(date=datetime.datetime.now())) logger.info("=== Starting build at {date} ===".format(date=datetime.datetime.now()))
logger.debug("Pulling the latest from master")
base_dir = os.path.abspath(os.path.dirname(__file__)) base_dir = os.path.abspath(os.path.dirname(__file__))
logger.debug("Checking for merge bot updates")
_git("fetch", "origin", cwd=base_dir)
_, stdout = _git("rev-list", "HEAD...origin/master", "--count", cwd=base_dir)
if stdout and int(stdout) > 0:
logger.info("=> Changes detected. Pulling latest version and restarting the application")
_git("pull", "origin", "master", cwd=base_dir)
os.execv(sys.executable, [sys.executable] + sys.argv)
sys.exit(0)
else:
logger.debug("=> No changes to the script repo were detected. Continuing.")
t = TagMergeBot(MAIN_REPO, PULL_REPOS, PUSH_REPO) t = TagMergeBot(MAIN_REPO, PULL_REPOS, PUSH_REPO)
ret = t.fetch_latest_prs() ret = t.fetch_latest_prs()