Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions .github/actions/check_run/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ inputs:
required: true
workflow_name:
description: Workflow name to post check_run
required: false
required: true

runs:
using: "composite"
Expand All @@ -42,9 +42,24 @@ runs:
ACCESS_TOKEN="${{ steps.app-token.outputs.token }}"
s3_location="${{ inputs.s3_location }}"
REPO="${{ inputs.repo }}"
post_name="Artifacts${{ inputs.workflow_name }} uploaded to S3"
workflow_name="${{ inputs.workflow_name }}"

echo "Creating check run for workflow : $workflow_name and commit: $HEAD_SHA"

if [ "$workflow_name" = "pre_merge" ] || [ "$workflow_name" = "pre_merge_ubuntu" ] || [ "$workflow_name" = "pre_merge_yocto" ]; then
post_name="Artifacts for ${{ inputs.workflow_name }} uploaded to S3"
title="Check S3 Location"
text=$s3_location
elif [ "$workflow_name" = "Kernel Checkers" ]; then
post_name="Kernel Checkers passed"
echo "$post_name"
title="Kernel checker"
text=""
fi

echo "Post name : $post_name"
echo "Title : $title"

echo "Creating check run for commit: $HEAD_SHA"
CHECK_RUN_ID=$(curl -s -L -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
Expand All @@ -55,16 +70,16 @@ runs:
"head_sha": "'"$HEAD_SHA"'",
"status": "in_progress",
"output": {
"title": "Check S3 Location",
"title": "'"$title"'",
"summary": "",
"text": "'"$s3_location"'"
"text": "'"$text"'"
}
}' | jq -r '.id')

if [ -z "$CHECK_RUN_ID" ]; then
echo "Failed to create check run. Exiting."
exit 1
fi
if [ -z "$CHECK_RUN_ID" ]; then
echo "Failed to create check run. Exiting."
exit 1
fi

echo "Check run created with ID: $CHECK_RUN_ID"

Expand All @@ -80,10 +95,10 @@ runs:
"status": "completed",
"conclusion": "success",
"output": {
"title": "Check S3 Location",
"title": "'"$title"'",
"summary": "",
"text": "'"$s3_location"'"
"text": "'"$text"'"
}
}'

echo "Check run updated successfully."
echo "Check run updated successfully for $workflow_name"
87 changes: 87 additions & 0 deletions .github/workflows/checker_override.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Checker Override
on:
workflow_dispatch:
inputs:
pr_number:
description: Pull request number
type: string
required: true
repo:
description: Target repository
type: string
required: true
reason:
description: Reason for override
type: string
required: true

jobs:
extract-pr-metadata:
name: Extract PR Data
runs-on: ubuntu-latest
outputs:
pr_sha: ${{ steps.capture.outputs.pr_sha }}
pr_branch: ${{ steps.capture.outputs.pr_branch }}

steps:
- name: Capture PR metadata
id: capture
uses: actions/github-script@v7
with:
script: |
const prNumber = ${{ inputs.pr_number }};
const full = "${{ inputs.repo }}";
const [owner, repo] = full.split("/");

// Fetch PR details
const { data: pr } = await github.rest.pulls.get({
owner,
repo,
pull_number: prNumber,
});

const prSha = pr.head.sha; // commit SHA of PR head
const prBranch = pr.base.ref; // source branch name

core.setOutput('pr_sha', prSha);
core.setOutput('pr_branch', prBranch);

- name: Show values (for logs)
run: |
echo "PR number: ${{ inputs.pr_number }}"
echo "PR SHA: ${{ steps.capture.outputs.pr_sha }}"
echo "PR Branch: ${{ steps.capture.outputs.pr_branch }}"

check_run:
runs-on: ubuntu-latest
needs: [extract-pr-metadata]
steps:
- name: Post check run
if: ${{ needs.extract-pr-metadata.outputs.pr_branch == 'qcom-6.18.y' }}
uses: qualcomm-linux/kernel-config/.github/actions/check_run@main
with:
sha: ${{ needs.extract-pr-metadata.outputs.pr_sha }}
repo: ${{ inputs.repo }}
APPID: ${{ secrets.APPID }}
PVK: ${{ secrets.PVK }}
workflow_name: "Kernel Checkers"

- name: Print Log
env:
PR_BRANCH: ${{ needs.extract-pr-metadata.outputs.pr_branch }}
TOKEN: ${{ secrets.PAT }}
run: |
if [ "$PR_BRANCH" = "qcom-6.18.y" ]; then
echo "Checker Override for branch qcom-6.18.y"

curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ inputs.repo }}/issues/${{ inputs.pr_number }}/comments \
-d '{"body":"Kernel Checker override by ${{ github.actor }} for SHA : ${{ needs.extract-pr-metadata.outputs.pr_sha }}\n Reason: ${{ inputs.reason }}"}'

else
echo "Branch not applicable for override.."
fi
16 changes: 15 additions & 1 deletion .github/workflows/kernel_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,21 @@ jobs:
check: [check-patch-compliance, check-uapi-headers, sparse-check, checkpatch,
dt-binding-check, dtb-check]
fail-fast: false


check_run:
if: inputs.ref == 'qcom-6.18.y'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use some config to handle this? If a new branch comes then again we need to add a condition here

runs-on: ubuntu-latest
needs: [checker]
steps:
- name: Post check run
uses: qualcomm-linux/kernel-config/.github/actions/check_run@main
with:
sha: ${{ inputs.sha }}
repo: ${{ inputs.repo }}
APPID: ${{ secrets.APPID }}
PVK: ${{ secrets.PVK }}
workflow_name: "${{ github.workflow }}"

final-status:
runs-on: ubuntu-latest
needs: [checker]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-merge-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
sha: ${{ inputs.sha }}
repo: ${{ inputs.repo }}
s3_location: ${{ needs.generate_debians.outputs.artifacts_location }}
workflow_name: " for ${{ github.workflow }}"
workflow_name: "${{ github.workflow }}"
APPID: ${{ secrets.APPID }}
PVK: ${{ secrets.PVK }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-merge-yocto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
sha: ${{ inputs.sha }}
repo: ${{ inputs.repo }}
s3_location: ${{ needs.build_yocto.outputs.artifacts_location }}
workflow_name: " for ${{ github.workflow }}"
workflow_name: "${{ github.workflow }}"
APPID: ${{ secrets.APPID }}
PVK: ${{ secrets.PVK }}

Expand Down