Skip to content

Commit 35b75ce

Browse files
author
Philip Keicher
committed
make pr creation conditional
1 parent 6b3ae8b commit 35b75ce

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: .github/workflows/sync_overleaf.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ permissions:
1010
name: "Sync overleaf"
1111
jobs:
1212
sync:
13-
runs-on: ubuntu-latest
14-
steps:
13+
runs-on: ubuntu-latest
14+
steps:
1515
- uses: actions/checkout@v4
1616
with:
1717
ref: sync_overleaf
1818
fetch-depth: '0'
19+
1920
- name: Sync overleaf
21+
id: sync_overleaf
2022
run: |
2123
git remote add overleaf https://git:${OVERLEAF_TOKEN}@git.overleaf.com/65df171af9ff7989580f017d
2224
git remote add origin_token https://git:${GITHUB_TOKEN}@github.com/columnflow/demo_docs.git
@@ -25,10 +27,14 @@ jobs:
2527
git pull overleaf master
2628
git push origin_token HEAD:sync_overleaf
2729
30+
commitDiffCount=$(git diff origin_token/sync_overleaf origin_token/master | wc -l)
31+
echo "$foo" >> $GITHUB_OUTPUT
32+
2833
env:
2934
OVERLEAF_TOKEN: ${{ secrets.OVERLEAF_TOKEN }}
3035
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3136
- name: create pull request
37+
if: steps.sync_overleaf.outputs.commitDiffCount > 0
3238
run: gh pr create -B master -H sync_overleaf --title 'Merge sync_overleaf into master' --body 'Created by Github action'
3339
env:
3440
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)