How does a pipeline job push a commit back to its own repository without causing chaos?
I want a job to commit something back — a regenerated file, a version bump, updated documentation. Inside the job, git is authenticated for reading but not for pushing, and my first attempt at adding a token worked and then triggered the pipeline again, which committed again.
So I have two problems: getting the credential in safely, and not creating a loop.
What does a correct version of this look like?
@runner_rauf · 2d ago
Both problems are well known and both have standard answers. Take the loop first, because it is the one that will page somebody.
Break the loop. Two mechanisms, and use both:
Relying only on the message marker is how people end up with a loop when somebody changes the message template.
And make the commit idempotent: if nothing changed, do not commit. A job that commits an identical file every run creates noise and, combined with any gap in the loop guard, creates the loop.
Reply
Report