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
31 changes: 31 additions & 0 deletions .github/workflows/check-pr-author.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check PR Author for Merge Permission

on:
pull_request:
types: [opened, synchronize, reopened] # Trigger on new PRs or updates

permissions:
statuses: write
pull-requests: read

jobs:
check-author:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const allowedUsers = ['keone', 'NoahMarconi', 'AustinGreen', 'kristovatlas', 'therealharpaljadeja', 'nishuzumi', 'portdeveloper']; // Keone, Security Team, Head of Eng, DevRel
const prAuthor = context.payload.pull_request.user.login;
const state = allowedUsers.includes(prAuthor) ? 'success' : 'failure';
const description = allowedUsers.includes(prAuthor) ? 'PR author is allowed to merge' : 'PR author not allowed to merge';

await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.pull_request.head.sha,
state: state,
context: 'merge-allowed-check', // Custom name for the status check
description: description
});