Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
imskr committed Jul 17, 2022
1 parent da67e94 commit 58028ed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 24 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@
![result](./public/images/results.png)

<!-- BLOG-LIST-START -->
- [Deploy Your Java Spring Boot Application on AWS EC2 Using GitHub Actions and Docker](https://betterprogramming.pub/deploy-your-spring-boot-java-application-to-aws-ec2-using-github-actions-and-docker-e28c456a4b1a?source=rss-2612c96405e4------2)

- [From Open Source Contributor to Google SoC at GitLab](https://medium.com/geekculture/gitlab-google-summer-of-code-e5e819547ee7?source=rss-2612c96405e4------2)

- [How To Build Your First Chrome Extension in 5 Minutes](https://medium.com/dailyjs/how-to-build-your-first-chrome-extension-in-5-min-1dbe3eb94575?source=rss-2612c96405e4------2)
<!-- BLOG-LIST-END -->
48 changes: 29 additions & 19 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"net/http"
"os/exec"
"strings"

medium "github.com/readme-update-actions/pkg/structs"
helpers "github.com/readme-update-actions/pkg/utils"
Expand Down Expand Up @@ -101,27 +102,36 @@ func main() {
log.Fatalf("Error setting git email %s", err)
}

// add to staging area
addCmd := exec.Command("git", "add", readme_path)
err = addCmd.Run()
// check git status
statusCmd, err := exec.Command("git", "status").Output()
if err != nil {
log.Fatalf("Error adding to staging area %s", err)
return
log.Fatal(err)
}

// do git commit
commitCmd := exec.Command("git", "commit", "-m", commit_message)
err = commitCmd.Run()
if err != nil {
log.Fatalf("Error commiting to repo %s", err)
return
}

// do git push
pushCmd := exec.Command("git", "push")
err = pushCmd.Run()
if err != nil {
log.Fatalf("Error pushing to repo %s", err)
return
statusOutput := string(statusCmd)
if !strings.Contains(statusOutput, "nothing to commit") {
// add to staging area
addCmd := exec.Command("git", "add", readme_path)
err = addCmd.Run()
if err != nil {
log.Fatalf("Error adding to staging area %s", err)
return
}

// do git commit
commitCmd := exec.Command("git", "commit", "-m", commit_message)
err = commitCmd.Run()
if err != nil {
log.Fatalf("Error commiting to repo %s", err)
return
}

// do git push
pushCmd := exec.Command("git", "push")
err = pushCmd.Run()
if err != nil {
log.Fatalf("Error pushing to repo %s", err)
return
}
}
}

0 comments on commit 58028ed

Please sign in to comment.