-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: init * fix: add scarb * fix: update * fix: new syntax * fix * fix * fix * fix * Fix * fix * revert * fix * revert * test * fix * test * test * TEST * test * feat:comment on pr * test:gas change * revert * test: introducing multiple gas reduction * test * fix * test * test * test * test * TEST * revert * test * test * revert * restore * gas_change + test * test * test * test * test * test * debug * test * test * test * test * test * test * test * test * test * test * test * test * test * test * final * add options * test * test * test * restore tests
- Loading branch information
Showing
2 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Compare Snapshot | ||
|
||
on: pull_request | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
compare_snapshot: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.x" # Specify the Python version required | ||
- name: Set up Scarb | ||
uses: software-mansion/setup-scarb@v1 | ||
|
||
- name: Run compare_snapshot script | ||
id: run_script | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
run: | | ||
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | ||
result=$(python scripts/gas_usage/compare_snapshot.py| sed 's/\x1b\[[0-9;]*m//g') | ||
result=$(echo "$result" | grep -v "Archive:") | ||
result=$(echo "$result" | grep -v "inflating:") | ||
echo "$result" > temp_result.txt | ||
echo "output<<$EOF" >> $GITHUB_OUTPUT | ||
cat temp_result.txt >> $GITHUB_OUTPUT | ||
echo "$EOF" >> $GITHUB_OUTPUT | ||
outputs: | ||
output: ${{ steps.run_script.outputs.output }} | ||
display_result: | ||
needs: compare_snapshot | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Comment on PR | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
run: | | ||
output="${{needs.compare_snapshot.outputs.output}}" | ||
echo "Debug: output for PR comment = $output" | ||
pr_number=$(jq -r ".number" "$GITHUB_EVENT_PATH") | ||
repo_full_name=$(jq -r ".repository.full_name" "$GITHUB_EVENT_PATH") | ||
comment=$(printf "Output from Compare Snapshot:\\n\`\`\`\\n%s\\n\`\`\`" "$output") | ||
comment=$(jq -n --arg body "$comment" '{body: $body}') | ||
curl \ | ||
-X POST \ | ||
-H "Authorization: token $GITHUB_TOKEN" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/$repo_full_name/issues/$pr_number/comments \ | ||
-d "$comment" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters