Skip to content

Commit

Permalink
Check if there are new commits to sync fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
semeniak97mf committed Aug 22, 2024
1 parent 1875ff9 commit 4015119
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/sync-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
run: |
if [ $(git rev-list HEAD...upstream/master --count) -ne 0 ]; then
echo "New commits found"
echo "new_commits=true" >> $GITHUB_ENV
echo "::set-output name=new_commits::true"
else
echo "This branch is up to date"
echo "new_commits=false" >> $GITHUB_ENV
echo "::set-output name=new_commits::false"
fi
- name: Push changes to origin
Expand All @@ -58,14 +58,14 @@ jobs:
git pull upstream --ff-only
git push origin upstream
- name: Check if PR already exists
- name: Push changes to origin
if: steps.check_commits.outputs.new_commit == 'true'
id: check_pr_exists
env:
GH_TOKEN: ${{ github.token }}
run: |
pr_count=$(gh pr list --repo ${{ github.repository }} --json 'headRefName' --jq 'map(select(.headRefName == "upstream")) | length')
echo "pr_count=${pr_count}" >> $GITHUB_ENV
echo "::set-output name=pr_count::${pr_count}"
if [ "$pr_count" -gt 0 ]; then
echo "Pull Request already exists."
Expand Down

0 comments on commit 4015119

Please sign in to comment.