Commit

Automations: say plainly why a run was skipped to avoid a loop

The check skips a change any automation made to something this one changed in the last 10 minutes; the reason and the guide now say so. Template code on the Automations page wraps instead of clipping.

syntaqxcommitted Parent4be6b5cBrowse files
3 files+11−70/3 viewed
+6−4
167167
168168 - **Once per event.** An event runs each automation at most once, even if
169169 it is delivered again.
170−- **No loops.** An automation does not answer an event that its own run
171− caused on the same issue or pull request in the last 10 minutes. An
172− automation that labels issues on `issue.updated` does not keep running
173− because it labelled one.
170+- **No loops.** An automation that changed an issue or pull request in
171+ the last 10 minutes does not answer a change to it that an automation
172+ made, whether itself or another. An automation that labels issues on
173+ `issue.updated` does not keep running because it labelled one, and two
174+ automations cannot set each other off. Changes people and agents make
175+ are answered as usual.
174176 - **A limit per hour.** An automation makes at most 30 runs an hour.
175177 Runs past the limit are skipped and recorded. Change the limit, up to
176178 200, with:
+1−1
234234 <p className="font-medium">{template.title}</p>
235235 <p className="mt-1 text-xs text-muted">{template.about}</p>
236236 <p className="mt-3 font-mono text-xs text-faint">.g1t/automations/{template.file}</p>
237− <pre className="mt-1.5 overflow-x-auto rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed ring-1 ring-line">
237+ <pre className="mt-1.5 rounded-lg bg-bg p-3 font-mono text-xs leading-relaxed break-words whitespace-pre-wrap ring-1 ring-line">
238238 <code>{template.yaml}</code>
239239 </pre>
240240 </div>
+4−2
563563 .await?
564564 .is_some_and(|count| count.n > 0);
565565 if recent {
566− self.finish(&run_id, "skipped", Some("This came from its own last run, so it did not answer it."), &[], actor_name.as_deref())
567− .await?;
566+ let reason = format!(
567+ "An automation made this change, and this one changed #{number} in the last 10 minutes, so it did not answer: that could loop."
568+ );
569+ self.finish(&run_id, "skipped", Some(&reason), &[], actor_name.as_deref()).await?;
568570 return Ok(Some(run_id));
569571 }
570572 }