Skip to content

Commit

Permalink
ci(GODIET-73): 👷 change the way to get all commits
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorrsousaa committed Mar 20, 2024
1 parent 976bb5a commit 4af8048
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/update-pr-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,24 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Update PR description with commit list
uses: octokit/[email protected]
with:
route: PATCH /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}
mediaType: application/vnd.github.v3+json
body: |
${{ github.event.pull_request.body }}
## Lista de commits:
$(git log --pretty=format:"* %s (%h)" ${{ github.event.before }}..${{ github.sha }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Add PR base ref
# Fetch the ref of the base branch, just the single commit.
run: git fetch --depth=1 origin +refs/heads/${{github.base_ref}}:refs/remotes/origin/${{github.base_ref}}
- name: Track PR base branch
# Turn the just-fetched ref into a local branch.
run: git branch --track ${{github.base_ref}} origin/${{github.base_ref}}
- name: Fetch commits in-between base and HEAD
# While the ancestor commit between HEAD and the branch base isn't in the local tree
# fetch X more parent commits of the branch base and branch head.
run: |
while [ -z $( git merge-base ${{github.base_ref}} HEAD ) ]; do
git fetch --deepen=10 origin ${{github.base_ref}} HEAD;
done
# Sets the commit SHAs of head and branch base into two environment variables
# that `nx affected` will read from.
- name: Derive SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v2
with:
main-branch-name: ${{github.base_ref}}

0 comments on commit 4af8048

Please sign in to comment.