From ce4a7b06245eff025ae17bd6c7197ed9887ade7b Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Tue, 6 Jul 2021 10:25:02 +0200 Subject: [PATCH 1/2] Create pragmaonce.yml --- .github/workflows/pragmaonce.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/pragmaonce.yml diff --git a/.github/workflows/pragmaonce.yml b/.github/workflows/pragmaonce.yml new file mode 100644 index 0000000000000..e0e24766ced89 --- /dev/null +++ b/.github/workflows/pragmaonce.yml @@ -0,0 +1,30 @@ +name: pragma-once checker + +on: [pull_request_target] + +jobs: + build: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + # We need the history of the dev branch all the way back to where the PR + # diverged. We're fetching everything here, as we don't know how many + # commits back that point is. + fetch-depth: 0 + + - name: Install prerequisites + env: + DEBIAN_FRONTEND: noninteractive + run: | + sudo apt update -y + sudo apt install -y git + - name: Run pragma check + id: pragma_check + env: + ALIBUILD_GITHUB_TOKEN: ${{secrets.ALIBUILD_GITHUB_TOKEN}} + run: | + git grep "#pragma once" | grep "\.h"; if [ $? -eq "0" ]; then exit 1; fi; exit 0 From fa4544321222e5394f7d9588fd32f47b9500179e Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Tue, 6 Jul 2021 10:38:17 +0200 Subject: [PATCH 2/2] Update pragmaonce.yml --- .github/workflows/pragmaonce.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/pragmaonce.yml b/.github/workflows/pragmaonce.yml index e0e24766ced89..9a6221379853e 100644 --- a/.github/workflows/pragmaonce.yml +++ b/.github/workflows/pragmaonce.yml @@ -11,20 +11,8 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} persist-credentials: false - # We need the history of the dev branch all the way back to where the PR - # diverged. We're fetching everything here, as we don't know how many - # commits back that point is. - fetch-depth: 0 - - name: Install prerequisites - env: - DEBIAN_FRONTEND: noninteractive - run: | - sudo apt update -y - sudo apt install -y git - name: Run pragma check id: pragma_check - env: - ALIBUILD_GITHUB_TOKEN: ${{secrets.ALIBUILD_GITHUB_TOKEN}} run: | - git grep "#pragma once" | grep "\.h"; if [ $? -eq "0" ]; then exit 1; fi; exit 0 + git grep -l '#pragma once' -- '*.h' && exit 1