Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with commit statuses. #136

Open
skelouse opened this issue Mar 18, 2024 · 1 comment
Open

Integrate with commit statuses. #136

skelouse opened this issue Mar 18, 2024 · 1 comment
Labels
feature New feature or request good first issue No deep understanding of tau needed

Comments

@skelouse
Copy link

skelouse commented Mar 18, 2024

In run send a GitHub commit status for pending, then on complete either error or success.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks

go-github is already used by the package so it can be used here, the logic would be:

func (m *Monkey) run(errs []error) {
        // commit status pending
        
	if err := m.RunJob(); err != nil {
		appendAndLog(errs, "Running job `%s` failed with error: %s", m.Id, err.Error())

		// commit status failed
	} else {
		m.logFile.Seek(0, io.SeekEnd)
		m.logFile.WriteString(chidori.Format(logger, log.LevelInfo, "\nRunning job `%s` was successful\n", m.Id))

		// commit status success
	}
}

Here's the create commit status endpoint from the typescript Octokit library, I'm not exactly sure how this would be done with the go-github library:

createCommitStatus: {
    parameters: RequestParameters & Omit<Endpoints["POST /repos/{owner}/{repo}/statuses/{sha}"]["parameters"], "baseUrl" | "headers" | "mediaType">;
    response: Endpoints["POST /repos/{owner}/{repo}/statuses/{sha}"]["response"];
};

Example

image

@samyfodil samyfodil added feature New feature or request good first issue No deep understanding of tau needed labels May 4, 2024
@samyfodil
Copy link
Contributor

@skelouse can you add more details to the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request good first issue No deep understanding of tau needed
Projects
None yet
Development

No branches or pull requests

2 participants