| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f825341 commit 96673bc
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,6 +49,40 @@ jobs: | |||
| 49 | 49 | run: npx envinfo | |
| 50 | 50 | - name: Lint C/C++ files | |
| 51 | 51 | run: make lint-cpp | |
| 52 | + format-cpp: | ||
| 53 | + if: ${{ github.event.pull_request.draft == false && github.base_ref == 'master' }} | ||
| 54 | + runs-on: ubuntu-latest | ||
| 55 | + steps: | ||
| 56 | + - uses: actions/checkout@v3 | ||
| 57 | + with: | ||
| 58 | + fetch-depth: 0 | ||
| 59 | + persist-credentials: false | ||
| 60 | + - name: Use Node.js ${{ env.NODE_VERSION }} | ||
| 61 | + uses: actions/setup-node@v3 | ||
| 62 | + with: | ||
| 63 | + node-version: ${{ env.NODE_VERSION }} | ||
| 64 | + - name: Set up Python ${{ env.PYTHON_VERSION }} | ||
| 65 | + uses: actions/setup-python@v3 | ||
| 66 | + with: | ||
| 67 | + python-version: ${{ env.PYTHON_VERSION }} | ||
| 68 | + - name: Environment Information | ||
| 69 | + run: npx envinfo | ||
| 70 | + - name: Format C/C++ files | ||
| 71 | + run: | | ||
| 72 | + make format-cpp-build | ||
| 73 | + CLANG_FORMAT_START="$(git merge-base HEAD refs/remotes/origin/$GITHUB_BASE_REF)" \ | ||
| 74 | + make format-cpp | ||
| 75 | + git --no-pager diff --exit-code && EXIT_CODE="$?" || EXIT_CODE="$?" | ||
| 76 | + if [ "$EXIT_CODE" != "0" ] | ||
| 77 | + then | ||
| 78 | + echo | ||
| 79 | + echo 'ERROR: Please run:' | ||
| 80 | + echo | ||
| 81 | + echo ' CLANG_FORMAT_START="$(git merge-base HEAD <target-branch-name>)" make format-cpp' | ||
| 82 | + echo | ||
| 83 | + echo 'to format the commits in your branch.' | ||
| 84 | + exit "$EXIT_CODE" | ||
| 85 | + fi | ||
| 52 | 86 | lint-js-and-md: | |
| 53 | 87 | if: github.event.pull_request.draft == false | |
| 54 | 88 | runs-on: ubuntu-latest | |
| Back | FazBrowse Home | New Git URL |
0 commit comments