Skip to content

Commit

Permalink
removed exec
Browse files Browse the repository at this point in the history
  • Loading branch information
Astisme committed Jan 2, 2025
1 parent cc90212 commit 08fb4ef
Showing 1 changed file with 22 additions and 27 deletions.
49 changes: 22 additions & 27 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,38 +34,33 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const { stdout, stderr } = await run("deno task lint");
const fs = require('fs');
// Run the lint task using the shell command
exec('deno task lint', (error, stdout, stderr) => {
// Capture any stderr (error output)
console.log('a',error);
console.log('b',stdout);
console.log('c',stderr,stderr.length === 0);
if (stderr) {
console.error(`stderr: ${stderr}`);
if (stderr.length === 0) return; // If there's no error output, exit early
// Capture any stderr (error output)
console.log('b',stdout);
console.log('c',stderr,stderr.length === 0);
if (stderr) {
console.error(`stderr: ${stderr}`);
if (stderr.length === 0) return; // If there's no error output, exit early
// Extract PR number from GitHub event path
const eventPath = process.env.GITHUB_EVENT_PATH;
const eventData = JSON.parse(fs.readFileSync(eventPath, 'utf8'));
const prNumber = eventData.pull_request.number;
// Extract PR number from GitHub event path
const eventPath = process.env.GITHUB_EVENT_PATH;
const eventData = JSON.parse(fs.readFileSync(eventPath, 'utf8'));
const prNumber = eventData.pull_request.number;
// Output the PR number and context issue number
console.log(prNumber);
console.log(context.issue.number);
// Output the PR number and context issue number
console.log(prNumber);
console.log(context.issue.number);
// Create a comment on the PR with the error message
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Linter Failed:\n\n\`\`\`${stderr}\`\`\``
});
} else if (error) {
console.error(`exec error: ${error}`);
}
});
// Create a comment on the PR with the error message
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Linter Failed:\n\n\`\`\`${stderr}\`\`\``
});
}
- name: Verify formatting
run: deno task fmt
Expand Down

0 comments on commit 08fb4ef

Please sign in to comment.