Skip to content

Commit

Permalink
updated PR pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
t0m3kz committed Feb 20, 2025
1 parent 48e5790 commit 05a6326
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,31 @@ jobs:
echo "Running test deployment"
poetry run -P vyos sync -i ./inventory.yaml -v -m -t
- name: Read files content and create PR comment
uses: actions/github-script@v7
uses: actions/github-script@v6
with:
github-token: ${{ secrets.TOKEN }}
github-token: ${{ secrets.ROBOT_TOKEN }}
script: |
const fs = require('fs');
const files = fs.readdirSync('changes');
const path = 'changes';
let content = '';
if (files.length === 0) {
if (!fs.existsSync(path)) {
content = 'No changes will be applied';
} else {
files.forEach(file => {
const fileContent = fs.readFileSync(`changes/${file}`, 'utf8');
content += `\n\n${fileContent}`;
});
const files = fs.readdirSync(path);
if (files.length === 0) {
content = 'No changes will be applied';
} else {
content = 'With this PR you\'ll apply these changes:';
files.forEach(file => {
const fileContent = fs.readFileSync(`${path}/${file}`, 'utf8');
content += `\n\n${fileContent}`;
});
}
}
const commentBody = `Hello! With this PR you'll apply these changes:\n\n${content}`;
const commentBody = `Hello! ${content}`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
});

0 comments on commit 05a6326

Please sign in to comment.