Я добавил ловушку git в свой проект при срабатывании события push.
Когда ловушка запущена и значение ref равно refs/heads/master
, файл prod index.html
будет обновлен.
Я хочу прочитать новый index.html
контент
router.post('/gitHook', async (ctx, next) => {
const body = ctx.request.body;
const matches = body.ref.match(/^refs\/heads\/(.*)/);
const branchName = matches[1];
console.log(branchName);
if(branchName === 'master'){
console.log('should get new code from git origin master')
}
await next();
});