Page MenuHomePhabricator

Differential Revision herald rule for Harbormaster build fired on commandeer + close
Closed, ResolvedPublic

Assigned To
Authored By
venky
Aug 24 2016, 11:19 PM
Referenced Files
F1781197: pasted_file
Aug 24 2016, 11:20 PM
F1781194: pasted_file
Aug 24 2016, 11:19 PM
Subscribers

Description

pasted_file (258×839 px, 44 KB)

Is this expected? I don't think I've had this happen on other similar actions.

My herald rule is set up like https://github.com/uber/phabricator-jenkins-plugin#herald

pasted_file (143×442 px, 17 KB)

Event Timeline

venky updated the task description. (Show Details)

Commandeer fires Herald rules so stuff like "Require Legalpad Signature" or "Add Reviewers: that intern's wrangler" work.

protected function shouldApplyHeraldRules(
  PhabricatorLiskDAO $object,
  array $xactions) {

  if ($this->getIsNewObject()) {
    return true;
  }

  foreach ($xactions as $xaction) {
    switch ($xaction->getTransactionType()) {
      case DifferentialTransaction::TYPE_UPDATE:
        if (!$this->getIsCloseByCommit()) {
          return true;
        }
        break;
      case DifferentialTransaction::TYPE_ACTION:
        switch ($xaction->getNewValue()) {
          case DifferentialAction::ACTION_CLAIM:
            // When users commandeer revisions, we may need to trigger
            // signatures or author-based rules.
            return true;
        }
        break;
    }
  }

  return parent::shouldApplyHeraldRules($object, $xactions);
}

Commandeer is a pretty infrequent action so this doesn't matter much, but out of curiosity could I avoid this with a better Herald rule? I guess I can try Changed file content matches regexp '.'.

epriestley claimed this task.

The action is indistinguishable from an update from Herald's perspective. Herald runs on the state of the object, not changes to it, so "Changed file content" will just match whatever the diff changes.