From 0fc2592a5ad3c919eb95236acca3a93105ba511e Mon Sep 17 00:00:00 2001 From: Suresh Kumar Reddy Vutukuru Date: Tue, 23 Dec 2025 14:14:53 +0530 Subject: [PATCH 1/5] This is a test branch This is a test Signed-off-by: Suresh Kumar Reddy Vutukuru --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1fbcb04..8b2a232 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # h2xml - +#touch this +#this is attea ## Introduction H2XML (Header to XML) is a generic tool for generating XML files from annotated C header files with Grammar and syntax of the annotations are similar to From 75b4766d92869b69b9542b9ae1b718e704eb5798 Mon Sep 17 00:00:00 2001 From: svutukur20 Date: Tue, 23 Dec 2025 16:42:29 +0530 Subject: [PATCH 2/5] Add ci-test Add ci-test Signed-off-by: svutukur20 --- .github/workflows/ci_test.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/ci_test.yml diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml new file mode 100644 index 0000000..a47d77f --- /dev/null +++ b/.github/workflows/ci_test.yml @@ -0,0 +1,37 @@ +name: CI only after 2 approvals + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review, review_requested] + pull_request_review: + types: [submitted] + +jobs: + check-approvals: + runs-on: ubuntu-latest + outputs: + approved: ${{ steps.check.outputs.approved }} + steps: + - uses: actions/github-script@v7 + id: check + with: + script: | + const reviews = await github.pulls.listReviews({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + + const approvals = reviews.data.filter( + r => r.state === "APPROVED" + ).length; + + core.setOutput("approved", approvals >= 2); + + build: + needs: check-approvals + if: needs.check-approvals.outputs.approved == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: echo "Running because 2 approvals are present" \ No newline at end of file From 604177ebf6bfd959b7d57a01d678e6f94be33c06 Mon Sep 17 00:00:00 2001 From: svutukur20 Date: Tue, 23 Dec 2025 17:07:08 +0530 Subject: [PATCH 3/5] Update ci_test.yml Signed-off-by: svutukur20 --- .github/workflows/ci_test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index a47d77f..ff38f88 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -5,6 +5,7 @@ on: types: [opened, synchronize, reopened, ready_for_review, review_requested] pull_request_review: types: [submitted] + jobs: check-approvals: @@ -34,4 +35,5 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: echo "Running because 2 approvals are present" \ No newline at end of file + + - run: echo "Running because 2 approvals are present" From 7142644f57ff27ec0f9c9ffc87e4617856ff1ac3 Mon Sep 17 00:00:00 2001 From: svutukur20 Date: Tue, 23 Dec 2025 17:10:14 +0530 Subject: [PATCH 4/5] Update ci_test.yml Signed-off-by: svutukur20 --- .github/workflows/ci_test.yml | 68 ++++++++++++++++++++++++++--------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index ff38f88..eefe771 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -1,39 +1,75 @@ + name: CI only after 2 approvals - + on: pull_request: types: [opened, synchronize, reopened, ready_for_review, review_requested] pull_request_review: types: [submitted] - +permissions: + contents: read + pull-requests: read + jobs: check-approvals: runs-on: ubuntu-latest outputs: approved: ${{ steps.check.outputs.approved }} + count: ${{ steps.check.outputs.count }} steps: - - uses: actions/github-script@v7 + - name: Print event basics + run: | + echo "Event name : ${{ github.event_name }}" + echo "Event action : ${{ github.event.action }}" + echo "Review state : ${{ github.event.review.state || 'n/a' }}" + echo "PR number : ${{ github.event.pull_request.number }}" + + - name: Count unique latest approvals id: check + uses: actions/github-script@v7 with: + github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const reviews = await github.pulls.listReviews({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, + const owner = context.repo.owner; + const repo = context.repo.repo; + const prNumber = context.payload.pull_request.number; + + // Fetch all reviews for the PR + const { data: reviews } = await github.rest.pulls.listReviews({ + owner, repo, pull_number: prNumber, per_page: 100 }); - - const approvals = reviews.data.filter( - r => r.state === "APPROVED" - ).length; - - core.setOutput("approved", approvals >= 2); - + + // Keep only the latest review per user + const latestByUser = new Map(); + for (const r of reviews) { + const key = r.user?.login; + const prev = latestByUser.get(key); + if (!prev || new Date(r.submitted_at) > new Date(prev.submitted_at)) { + latestByUser.set(key, r); + } + } + + // Count users whose latest state is APPROVED + const approvers = [...latestByUser.values()] + .filter(r => r.state === 'APPROVED') + .map(r => r.user.login); + + const count = approvers.length; + const threshold = 2; + + core.info(`Approvals (${count}): ${approvers.join(', ')}`); + core.setOutput('count', String(count)); + core.setOutput('approved', String(count >= threshold)); + build: needs: check-approvals + # Run only when the approval gate says "true" if: needs.check-approvals.outputs.approved == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - - run: echo "Running because 2 approvals are present" + - run: | + echo "Approval count: ${{ needs.check-approvals.outputs.count }}" + echo "Running because at least 2 approvals are present." + # Place your real CI steps here (build/test/deploy etc.) From 25d8f41acdc1930f455e6fca3dc2a93b547722d2 Mon Sep 17 00:00:00 2001 From: svutukur20 Date: Tue, 23 Dec 2025 17:10:57 +0530 Subject: [PATCH 5/5] Update ci_test.yml Signed-off-by: svutukur20 --- .github/workflows/ci_test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml index eefe771..87fed33 100644 --- a/.github/workflows/ci_test.yml +++ b/.github/workflows/ci_test.yml @@ -1,5 +1,5 @@ -name: CI only after 2 approvals +name: CsI only after 2 approvals on: pull_request: @@ -73,3 +73,4 @@ jobs: echo "Approval count: ${{ needs.check-approvals.outputs.count }}" echo "Running because at least 2 approvals are present." # Place your real CI steps here (build/test/deploy etc.) +