Skip to content

Commit

Permalink
fix: properly handle repository name and PR number in GitHub API calls
Browse files Browse the repository at this point in the history
Co-Authored-By: Michael Latman <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and michaellatman committed Dec 11, 2024
1 parent f100ec7 commit b0adcaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}

- name: Provide feedback
if: always()
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/pr-check.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ async function validateEnvironmentVariables(pkg) {
async function provideFeedback(newPackages) {
const { data: pullRequest } = await octokit.pulls.get({
owner: process.env.GITHUB_REPOSITORY_OWNER,
repo: process.env.GITHUB_REPOSITORY,
pull_number: process.env.GITHUB_PULL_REQUEST_NUMBER
repo: process.env.GITHUB_REPOSITORY.split('/')[1],
pull_number: parseInt(process.env.GITHUB_PULL_REQUEST_NUMBER, 10)
});

const feedback = newPackages.length > 0
Expand All @@ -175,7 +175,7 @@ async function provideFeedback(newPackages) {

await octokit.issues.createComment({
owner: process.env.GITHUB_REPOSITORY_OWNER,
repo: process.env.GITHUB_REPOSITORY,
repo: process.env.GITHUB_REPOSITORY.split('/')[1],
issue_number: pullRequest.number,
body: feedback
});
Expand Down

0 comments on commit b0adcaf

Please sign in to comment.