Skip to content

Commit

Permalink
make pr creation conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Keicher committed Oct 21, 2024
1 parent 6b3ae8b commit 35b75ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/sync_overleaf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ permissions:
name: "Sync overleaf"
jobs:
sync:
runs-on: ubuntu-latest
steps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: sync_overleaf
fetch-depth: '0'

- name: Sync overleaf
id: sync_overleaf
run: |
git remote add overleaf https://git:${OVERLEAF_TOKEN}@git.overleaf.com/65df171af9ff7989580f017d
git remote add origin_token https://git:${GITHUB_TOKEN}@github.com/columnflow/demo_docs.git
Expand All @@ -25,10 +27,14 @@ jobs:
git pull overleaf master
git push origin_token HEAD:sync_overleaf
commitDiffCount=$(git diff origin_token/sync_overleaf origin_token/master | wc -l)
echo "$foo" >> $GITHUB_OUTPUT
env:
OVERLEAF_TOKEN: ${{ secrets.OVERLEAF_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: create pull request
if: steps.sync_overleaf.outputs.commitDiffCount > 0
run: gh pr create -B master -H sync_overleaf --title 'Merge sync_overleaf into master' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 35b75ce

Please sign in to comment.