0

I have a simple node app that uses GitHub webhooks that tell mes that a push has been made to my repo. I want to now be able to push those changes to another repo to sync them. I was trying to use simpleGit but it is not working for me.

This is my code:

//initializing repo using simpleGit
simpleGit.init().addRemote('origin', 'git@github.com:owner/my_repo.git');

octokit.request(`GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries`, {
        owner: owner,
        repo: repo,
        hook_id: 123456789,
    }).then(response => {
        octokit.request(`GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}`, {
            owner: owner,
            repo: repo,
            hook_id: 123456789,
            delivery_id: response.data[0].id
        }).then(response => {
            console.log(response.data.request['payload'].ref);
            if (response.data.request['payload'].ref == 'refs/heads/master') {
                console.log(response.data.request['payload'].commits);
                simpleGit.push('origin', 'master')
                    .then((success) => {
                        console.log(success);
                    }, (failed) => {
                        console.log('failed');
                    });
            }
        });
    });

I am getting the commits in my terminal and finally failed as well. How do I push my changes from 1 repo to another?

LeoDog896
  • 3,472
  • 1
  • 15
  • 40
nb_nb_nb
  • 1,243
  • 11
  • 36

0 Answers0