From 2f1faade0432b965e77fa95a3a053de336d034a3 Mon Sep 17 00:00:00 2001 From: Surya Undapalli <20pa5a1210@vishnu.edu.in> Date: Sun, 10 Dec 2023 00:00:45 +0530 Subject: [PATCH] feat: add files and commit (#143) Adding initial commit to project spin up --- .github/workflows/generate-linter.yml | 5 ++++- cmd/program/program.go | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate-linter.yml b/.github/workflows/generate-linter.yml index ae2fe55d..e62c621f 100644 --- a/.github/workflows/generate-linter.yml +++ b/.github/workflows/generate-linter.yml @@ -15,7 +15,6 @@ jobs: go-version: "1.20" - name: Install Dependencies run: go mod download - framework_matrix: needs: install_dependencies strategy: @@ -27,6 +26,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Commit report + run: | + git config --global user.name 'testname' + git config --global user.email 'testemail@users.noreply.github.com' - name: build templates run: script -q /dev/null -c "go run main.go create -n ${{ matrix.framework }} -f ${{ matrix.framework}} -d ${{matrix.driver}}" /dev/null - name: golangci-lint diff --git a/cmd/program/program.go b/cmd/program/program.go index 39a83b33..7ae3dc4a 100644 --- a/cmd/program/program.go +++ b/cmd/program/program.go @@ -431,6 +431,20 @@ func (p *Project) CreateMainFile() error { cobra.CheckErr(err) } + // Git add files + err = utils.ExecuteCmd("git", []string{"add", "."}, projectPath) + if err != nil { + log.Printf("Error adding files to git repo: %v", err) + cobra.CheckErr(err) + return err + } + // Git commit files + err = utils.ExecuteCmd("git", []string{"commit", "-m", "Initial commit"}, projectPath) + if err != nil { + log.Printf("Error committing files to git repo: %v", err) + cobra.CheckErr(err) + return err + } return nil }