Skip to content

Commit

Permalink
fix: disable template injection
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-uniswap authored Oct 9, 2024
1 parent 3a41caa commit 5412ddc
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,41 @@ jobs:
run: |
{
echo 'COVERAGE<<EOF'
forge coverage --ir-minimum | grep '^|' | grep -v 'test/' | tr -d \`
forge coverage --ir-minimum | grep '^|' | grep -v 'test/' | tr -d \` | tr -d $ | tr -d { | tr -d }
echo EOF
} >> "$GITHUB_OUTPUT"
env:
FOUNDRY_RPC_URL: "${{ secrets.RPC_URL }}"

- name: Check coverage is updated
uses: actions/github-script@v5
env:
OUTPUT: ${{ steps.coverage.outputs.COVERAGE }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { OUTPUT } = process.env;
const fs = require('fs');
const file = "coverage.txt"
if(!fs.existsSync(file)) {
console.log("Nothing to check");
return
}
const currentCoverage = fs.readFileSync(file, "utf8").trim();
const newCoverage = (`${{ steps.coverage.outputs.COVERAGE }}`).trim();
const newCoverage = (`${ OUTPUT }`).trim();
if (newCoverage != currentCoverage) {
core.setFailed(`Code coverage not updated. Run : forge coverage | grep '^|' | grep -v 'test/' > coverage.txt`);
}
- name: Comment on PR
id: comment
uses: actions/github-script@v5
env:
OUTPUT: ${{ steps.coverage.outputs.COVERAGE }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { OUTPUT } = process.env;
const {data: comments} = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -69,8 +75,7 @@ jobs:
const botComment = comments.find(comment => comment.user.id === 41898282)
const output = `${{ steps.coverage.outputs.COVERAGE }}`;
const commentBody = `Forge code coverage:\n${output}\n`;
const commentBody = `Forge code coverage:\n${ OUTPUT }\n`;
if (botComment) {
github.rest.issues.updateComment({
Expand Down

0 comments on commit 5412ddc

Please sign in to comment.