From 29c989937d535ea8f7d2cf20451d98f8bcd47c58 Mon Sep 17 00:00:00 2001 From: Edoardo Zoni Date: Fri, 15 Nov 2024 16:43:32 -0800 Subject: [PATCH] Debug new workflow to check files --- .github/workflows/check_diff.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check_diff.yml b/.github/workflows/check_diff.yml index 8c0dd8ba12d..3fa27d70cdf 100644 --- a/.github/workflows/check_diff.yml +++ b/.github/workflows/check_diff.yml @@ -15,9 +15,34 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Define base and head refs + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} + FORK_OWNER: ${{ github.event.pull_request.head.repo.owner.login }} + FORK_REPO: ${{ github.event.pull_request.head.repo.name }} + run: | + echo "Base ref: ${BASE_REF}" + echo "Head ref: ${HEAD_REF}" + echo "Fork owner: ${FORK_OWNER}" + echo "Fork repo: ${FORK_REPO}" + - name: Add forked repository as remote + env: + FORK_URL: https://github.com/${FORK_OWNER}/${FORK_REPO}.git + run: | + git remote add fork ${FORK_URL} + - name: Fetch base branch from main repository + run: | + git fetch origin ${BASE_REF} + - name: Fetch head branch from forked repository + run: | + git fetch fork ${HEAD_REF} - name: Get changed files + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} + HEAD_REF: ${{ github.event.pull_request.head.ref }} run: | - git diff --name-only --diff-filter=ACMRTUXB ${GITHUB_BASE_REF}..${GITHUB_HEAD_REF} > check_diff.txt + git diff --name-only --diff-filter=ACMRTUXB origin/${BASE_REF}..fork/${HEAD_REF} > check_diff.txt - name: Check changed files run: | if grep -v -E "^(docs|\.github)/" check_diff.txt; then @@ -26,4 +51,4 @@ jobs: echo "skip=true" >> ${GITHUB_OUTPUT} fi outputs: - skip: ${{ steps.check.outputs.skip_workflows }} + skip: ${{ steps.check.outputs.skip }}