Skip to content

Refactor getDiff to store the diff into the action #1693

Description

@jescalada

Is your feature request related to a problem? Please describe.

Right now, getDiff stores the diff as content in a step via step.setContent, making the diff harder to fetch from plugins (as of the plugin revamp #1683) and subsequent actions like scanDiff:

...
    step.log(`Executing "git diff ${commitFrom} ${action.commitTo}" in ${path}`);
    const revisionRange = `${commitFrom}..${action.commitTo}`;
    const diff = await git.diff([revisionRange]);
    step.log(diff);
    step.setContent(diff);
  } catch (error: unknown) {
    const msg = getErrorMessage(error);
    step.setError(msg);
  } finally {
    action.addStep(step);
  }
  return action;

Describe the solution you'd like
Refactor getDiff so that adding the diff as content isn't necessary. We might need to look into why it was done this way in the first place. If we need to keep it as step content, we can just store the diff regardless via action.diff = diff, and then refactor any usages to use that instead.

Additional context
Related plugin revamp: #1683

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions