简体   繁体   中英

Automating a script to run after every git commit on team repo?

I have done a lot of reading about this but to no avail. I have a team repo on GitHub which creates a Git Page build with jekyll. Whenever anybody changes/commits a file, I would like to update other files in this repo. Is there a way to automate a script to run whenever anybody in the team commits anything? I have tried two methods:

1. Pre-commit Hooks

Basically, I have managed to set this up locally using a pre-commit hook in the .git directory, however I can only configure this on my local repo, not the remote group one.

2. Jekyll Deploy Plugin

I have also looked into the jekyll plugins, but as far as I can tell these also only work locally due to the --safe flag which jekyll uses to build.

Does anyone know of a workaround?

I am now running a script to check for changes everyday using launchd which does the job, although I would have preferred some kind of hook.

The launchd script in turn runs a bash script:

date >> output.txt
cd /Path/to/Git/repo

git pull
python AnalysisToRun.py
git add .
git commit -m "updated after changes"
git push

If anyone comes up with a hookier, Gitier answer I am happy to change

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM