Skip to content

Fix four out-of-bounds reads in the lexer and tag URI validation #442

Fix four out-of-bounds reads in the lexer and tag URI validation

Fix four out-of-bounds reads in the lexer and tag URI validation #442

Workflow file for this run

name: Format_Check
on:
push:
branches:
- develop
- main
paths:
- .github/workflows/format_check.yml
- include/**
- scripts/**
- single_include/**
- tests/**
- tools/amalgamation/**
- CMakeLists.txt
- .clang-format
# Run on pull requests from both branches and forks.
pull_request:
paths:
- .github/workflows/format_check.yml
- include/**
- scripts/**
- single_include/**
- tests/**
- tools/amalgamation/**
- CMakeLists.txt
- .clang-format
workflow_dispatch:
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
jobs:
format-check:
timeout-minutes: 10
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
with:
repository: ${{github.event.pull_request.head.repo.full_name}}
ref: ${{github.event.pull_request.head.sha}}
persist-credentials: false
- name: Run clang-format style check
run: ${{github.workspace}}/scripts/run_clang_format.sh
- name: Run amalgamation check
run: ${{github.workspace}}/scripts/run_amalgamation.sh
- name: Detect diffs caused by formatting scripts
id: format_diff
env:
PR_NUMBER: ${{github.event.number}}
run: |
git diff --patch --no-color > ${{github.workspace}}/format_diff_pr${{env.PR_NUMBER}}.patch
if [ -s ${{github.workspace}}/format_diff_pr${{env.PR_NUMBER}}.patch ]; then
echo "The source code has not been formatted/amalgamated correctly. Diff:"
cat ${{github.workspace}}/format_diff_pr${{env.PR_NUMBER}}.patch
echo "has_diff=true" >> $GITHUB_OUTPUT
echo "Patch file created: format_diff_pr${{env.PR_NUMBER}}.patch"
echo "patch_file_name=format_diff_pr${{env.PR_NUMBER}}.patch" >> $GITHUB_OUTPUT
exit 1
else
echo "No formatting issues detected."
echo "has_diff=false" >> $GITHUB_OUTPUT
fi
- name: Upload patch
id: upload_artifact_step
if: steps.format_diff.outputs.has_diff == 'true'
uses: actions/upload-artifact@v7
with:
name: ${{steps.format_diff.outputs.patch_file_name}}
path: ${{steps.format_diff.outputs.patch_file_name}}
overwrite: true
- name: Notify the artifact URL
if: steps.upload_artifact_step.conclusion == 'success'
uses: thollander/actions-comment-pull-request@v3
with:
message: |
## :octocat: Format/Amalgamation Check Failed
The source code has not been formatted/amalgamated correctly in the commit [${{github.event.pull_request.head.sha}}](https://github.com/${{github.repository}}/commit/${{github.event.pull_request.head.sha}}).
Please download and apply the patch to fix it.
| Name | ${{steps.format_diff.outputs.patch_file_name}}.zip |
|:-----|:-----------------------------------------------------|
| ID | ${{steps.upload_artifact_step.outputs.artifact-id}} |
| URL | ${{steps.upload_artifact_step.outputs.artifact-url}} |
comment-tag: format_notification