From be70a45f93195de55cac3de04c711d9e6a27d8e6 Mon Sep 17 00:00:00 2001 From: Can Bulut Bayburt Date: Sun, 24 Nov 2024 20:00:37 +0100 Subject: [PATCH] squash! Use gh CLI to get the PR diff --- .github/workflows/changelogs.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/changelogs.yml b/.github/workflows/changelogs.yml index 4b777dad6cc..fa178d51fd9 100644 --- a/.github/workflows/changelogs.yml +++ b/.github/workflows/changelogs.yml @@ -48,9 +48,18 @@ jobs: name: Changelog tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 + - name: Clone PR head branch + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HEAD_REPO: ${{ github.event.pull_request.head.repo.clone_url }} + HEAD_BRANCH: ${{ github.event.pull_request.head.ref }} + run: | + echo "Cloning head branch from $HEAD_REPO" + git clone --depth 2 --branch $HEAD_BRANCH $HEAD_REPO uyuni + cd uyuni + echo $(pwd) + ls -R . + git log -1 - id: master name: Get modified master changelog files uses: Ana06/get-changed-files@v2.3.0 @@ -68,6 +77,9 @@ jobs: echo echo "See https://github.com/uyuni-project/uyuni/wiki/Contributing for a guide to writing changelogs." exit 1 + - id: files + name: Get changed files + uses: Ana06/get-changed-files@v2.3.0 - name: Test changelog entries env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -75,9 +87,8 @@ jobs: run: | pip install python-bugzilla~=3.2.0 - CHANGED_FILES=$(gh pr diff -R ${{ github.event.pull_request.base.repo.full_name }} \ - ${{ github.event.pull_request.number }} --name-only) - echo $CHANGED_FILES + echo "Changed files:" + echo ${{ steps.files.outputs.added_modified }} # Tracker file can be retrieved from the OBS/IBS API # by calling 'osc api /issue_trackers/' (with authentication) @@ -85,7 +96,7 @@ jobs: --tracker-file .github/workflows/changelogs/trackers.xml \ --git-repo uyuni-project/uyuni \ --pr-number ${{ github.event.pull_request.number }} \ - $CHANGED_FILES + ${{ steps.files.outputs.added_modified }} # Warns the user if they merged the PR, but the changelog test failed warn_user_if_merged: