From f1c64c3da4bd1fe4183ff82d97fd599d80d01999 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Date: Fri, 26 Sep 2025 21:36:14 +0200 Subject: [PATCH 1/3] github: fix self-hosted runner checkout issues The unified workflow had two critical issues with repository checkout on self-hosted runners. For pull requests, it attempted to fetch non-existent merge refs like "35/merge". For push events, it used incomplete HTTPS URLs missing the .git suffix. This fixes both by using proper GitHub PR refs (refs/pull/N/head) and complete HTTPS clone URLs with .git suffix for the public repository. Fixes: 1b740047 ("github: unify self-hosted runner workflows") Generated-by: Claude AI Signed-off-by: Daniel Gomez --- .github/workflows/kdevops.yml | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/kdevops.yml b/.github/workflows/kdevops.yml index ac2ac6251..e278b3065 100644 --- a/.github/workflows/kdevops.yml +++ b/.github/workflows/kdevops.yml @@ -184,23 +184,37 @@ jobs: # Repo exists - clean and update (like actions/checkout) git clean -ffdx git reset --hard HEAD - # Ensure correct remote URL - git remote set-url origin $GITHUB_SERVER_URL/$GITHUB_REPOSITORY - git fetch --depth=1 origin ${{ github.ref_name }} - git reset --hard FETCH_HEAD + # Ensure correct remote URL for public repo + git remote set-url origin ${{ github.server_url }}/${{ github.repository }}.git + + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + # For PRs, fetch the specific PR ref that GitHub creates + git fetch --depth=1 origin refs/pull/${{ github.event.number }}/head:pr-branch + git checkout pr-branch + else + # For push/schedule/workflow_dispatch, use the commit SHA directly + git fetch --depth=1 origin ${{ github.sha }} + git checkout ${{ github.sha }} + fi else # No repo - fresh clone with local mirror optimization if [[ -f "/mirror/kdevops.git/HEAD" ]]; then git clone --verbose --progress \ --reference /mirror/kdevops.git \ --depth=1 \ - --branch ${{ github.ref_name }} \ - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY . + ${{ github.server_url }}/${{ github.repository }}.git . else git clone --verbose --progress \ --depth=1 \ - --branch ${{ github.ref_name }} \ - $GITHUB_SERVER_URL/$GITHUB_REPOSITORY . + ${{ github.server_url }}/${{ github.repository }}.git . + fi + + # Checkout the specific commit + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + git fetch --depth=1 origin refs/pull/${{ github.event.number }}/head:pr-branch + git checkout pr-branch + else + git checkout ${{ github.sha }} fi fi From dcf24a996c5341ffa72bf77fff9858eddf29b16c Mon Sep 17 00:00:00 2001 From: Daniel Gomez Date: Fri, 26 Sep 2025 22:12:54 +0200 Subject: [PATCH 2/3] github: kdevops: add commit version reporting This displays the kdevops commit being used right after checkout instead of waiting until the end of the workflow. Users can now see which version is running right away for validation. Generated-by: Claude AI Signed-off-by: Daniel Gomez --- .github/workflows/kdevops.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/kdevops.yml b/.github/workflows/kdevops.yml index e278b3065..a14a2963b 100644 --- a/.github/workflows/kdevops.yml +++ b/.github/workflows/kdevops.yml @@ -218,6 +218,23 @@ jobs: fi fi + - name: Report kdevops commit information + shell: bash + run: | + set -euxo pipefail + + # Get current commit info + commit_sha=$(git rev-parse HEAD) + commit_short=$(git rev-parse --short HEAD) + commit_subject=$(git log -1 --pretty=format:"%s") + + # Report the kdevops version used + echo "::notice title=kdevops Commit::Using kdevops commit $commit_short ($commit_sha): $commit_subject" + + # Also show in regular output for logs + echo "✅ Running kdevops CI with commit: $commit_short" + echo "📝 Commit message: $commit_subject" + - name: Configure kdevops uses: ./.github/actions/configure with: From b3f0557faeada62019f896c522c1f18992ea1c85 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Date: Fri, 26 Sep 2025 22:13:30 +0200 Subject: [PATCH 3/3] github: eliminate duplicate CI runs for branch pushes This prevents wasteful duplicate CI execution that occurred when pushing to a branch and creating a PR from it. Now only main branch pushes and PRs to main trigger CI, with ci-testing/* branches available for direct push-based workflow testing while blocking PRs from those branches. Generated-by: Claude AI Signed-off-by: Daniel Gomez --- .github/workflows/kdevops.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kdevops.yml b/.github/workflows/kdevops.yml index a14a2963b..2eaf05075 100644 --- a/.github/workflows/kdevops.yml +++ b/.github/workflows/kdevops.yml @@ -7,10 +7,13 @@ on: - cron: '0 14 * * *' # Daily at 2 PM UTC push: branches: - - '**' + - main + - 'ci-testing/**' pull_request: branches: - - '**' + - main + branches-ignore: + - 'ci-testing/**' workflow_dispatch: inputs: ci_workflow: