Skip to content

Commit

Permalink
squash! Use gh CLI to get the PR diff
Browse files Browse the repository at this point in the history
  • Loading branch information
cbbayburt committed Nov 24, 2024
1 parent cbd2730 commit be70a45
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/changelogs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -68,24 +77,26 @@ 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 }}
BZ_TOKEN: ${{ secrets.BUGZILLA_TOKEN }}
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)
python .github/workflows/changelogs/changelogs.py -v \
--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:
Expand Down

0 comments on commit be70a45

Please sign in to comment.