Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .github/workflows/guard-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,12 @@ jobs:
script: |
const pr = context.payload.pull_request;
const author = pr.user.login;
const assoc = pr.author_association;

const botAllowlist = new Set(['dependabot[bot]']);
const orgAuthorAssociations = new Set(['MEMBER', 'OWNER']);
// Is PR branch in the same repo (not a fork)?
const sameRepo =
pr.head.repo != null && pr.head.repo.id === pr.base.repo.id;

const allowed =
botAllowlist.has(author) ||
(assoc != null && orgAuthorAssociations.has(assoc));

if (!allowed) {
if (!sameRepo) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -48,5 +44,5 @@ jobs:

core.setFailed('Dependency changes are restricted to organization members.');
} else {
console.log(`Author ${author} (author_association=${assoc}) is allowed to make dependency changes.`);
console.log(`Author ${author} (sameRepo=${sameRepo}) is allowed to make dependency changes.`);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it makes sense to still refer to author here? Maybe just something like "This PR (...) is allowed ..." ?

}
Loading