Skip to content

Commit

Permalink
Check pr author for autoformat (#12343)
Browse files Browse the repository at this point in the history
Signed-off-by: Serena Ruan <serena.rxy@gmail.com>
  • Loading branch information
serena-ruan committed Jun 13, 2024
1 parent ecdb3e8 commit c4b2c05
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/autoformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const getPullInformation = async (context, github) => {
base_sha,
base_ref,
base_repo: base_repo.full_name,
author_association: pr.data.author_association,
};
};

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/autoformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ jobs:
core.debug(JSON.stringify(context, null, 2));
const autoformat = require('./.github/workflows/autoformat.js');
const { comment } = context.payload;
const isMaintainer = autoformat.isMlflowMaintainer(comment.author_association);
const pullInfo = await autoformat.getPullInformation(context, github);
const isMaintainer = autoformat.isMlflowMaintainer(comment.author_association) && autoformat.isMlflowMaintainer(pullInfo.author_association);
if (!isMaintainer) {
core.setFailed("Only MLflow maintainers can trigger this workflow.");
core.setFailed("Only MLflow maintainers can trigger this workflow in their PRs.");
}
const shouldAutoformat = autoformat.shouldAutoformat(comment);
if (shouldAutoformat) {
await autoformat.createReaction(context, github);
await autoformat.createStatus(context, github, core);
}
const pullInfo = await autoformat.getPullInformation(context, github);
return { ...pullInfo, shouldAutoformat };
format:
Expand Down

0 comments on commit c4b2c05

Please sign in to comment.