From efdbee31595390d69bebc6bb60d96f0b8419fb3e Mon Sep 17 00:00:00 2001 From: Jadit19 Date: Sat, 26 Oct 2024 23:09:26 +0530 Subject: [PATCH] add on pr workflow --- .github/workflows/pr.yaml | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/pr.yaml diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..7bf4ef6 --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,55 @@ +name: "Pull Request check" + +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clone submodules + run: | + git submodule init + git submodule update + - name: Update and Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y cmake build-essential g++ + - name: Build + id: build + run: | + mkdir build + cd build + cmake .. + make + - name: Post success comment + if: ${{ success() }} + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Build successful! 🎉' + }); + - name: Post failure comment + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + ...context.repo, + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `Build failed! ❌\n\n\`\`\`\n${{ steps.build.outputs.stderr || 'Unknown error' }}\n\`\`\`` + }); \ No newline at end of file