Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion .github/scripts/assign-reviewers.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ function fileMatchesPattern(filePath, pattern) {

function getChangedFiles() {
try {
const output = execSync('git diff --name-only origin/master...HEAD', {
const { BASE_SHA, HEAD_SHA } = process.env

if (!BASE_SHA || !HEAD_SHA) {
console.error('BASE_SHA and HEAD_SHA environment variables are required')
return []
}

const output = execSync(`git diff --name-only ${BASE_SHA}...${HEAD_SHA}`, {
encoding: 'utf8',
stdio: ['pipe', 'pipe', 'ignore'],
})
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/auto-assign-reviewers.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Auto Assign Reviewers

on:
pull_request:
pull_request_target:
# Only opened or when clicking ready otherwise you can never remove the reviewers
types: [opened, ready_for_review]

Expand All @@ -19,6 +19,7 @@
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -28,10 +29,12 @@
- name: Fetch master branch
run: git fetch origin master

- name: Run reviewer assignment script
env:
GITHUB_TOKEN: ${{ secrets.POSTHOG_BOT_GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
node .github/scripts/assign-reviewers.js

Check failure

Code scanning / CodeQL

Checkout of untrusted code in a privileged context Critical

Potential execution of untrusted code on a privileged workflow (
pull_request_target
)
Loading