atomist-skills / skill

API to implement a JavaScript/TypeScript-based Atomist Skills
Apache License 2.0
0 stars 0 forks source link

Create edit/commit/push functionality for git #151

Closed ddgenome closed 3 years ago

ddgenome commented 3 years ago

In thinking about https://github.com/atomist-skills/keep-a-changelog-skill/issues/67 , I wonder if it might be helpful to offer a function that applies a change, commits it, and pushes it. The "change" would likely be in the form of a function argument to run. The pseudo code representation would be:

  1. Execute change function
  2. Commit change
  3. Push change
  4. If push fails, git reset --hard origin/BRANCH GOTO 1
cdupuis commented 3 years ago

I like that idea.

If I understand it, I think I implemented something similar or at least the start of this: See https://github.com/atomist-skills/skill/blob/main/lib/github/pull_request.ts#L48. Although this doesn't deal with repeated changes and resets.

I think we should implement that as separate function.

cdupuis commented 3 years ago

@ddgenome, do you want to take this?

ddgenome commented 3 years ago

Yes to everything.

The persistChanges function seems like a great start and the place to add in this idea of "retry".

I'll get started on implementing it.

Thanks for the pointers.