Skip to content

Commit 8f62c1c

Browse files
authored
Merge pull request #121 from bigbio/dev
Dev
2 parents 297bf32 + 9940f3d commit 8f62c1c

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

.github/workflows/update_examples.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,33 @@ jobs:
2727
run: |
2828
python docs/update_examples.py
2929
30-
- name: Commit and push changes to dev-docs-update
31-
uses: stefanzweifel/git-auto-commit-action@v5
30+
- name: Check if changes were made
31+
id: check_changes
32+
run: |
33+
if [[ -n $(git status --porcelain docs/) ]]; then
34+
echo "changes_detected=true" >> $GITHUB_OUTPUT
35+
else
36+
echo "changes_detected=false" >> $GITHUB_OUTPUT
37+
fi
38+
39+
- name: Check for existing PR
40+
if: steps.check_changes.outputs.changes_detected == 'true'
41+
id: check_pr
42+
uses: actions/github-script@v6
3243
with:
33-
commit_message: "Update pmultiqc documentation and examples"
34-
branch: dev-docs-update
35-
create_branch: true
36-
push_options: '--force'
37-
commit_user_name: GitHub Actions
38-
commit_user_email: actions@github.com
39-
file_pattern: docs/*
44+
script: |
45+
const { data: pulls } = await github.rest.pulls.list({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
head: `${context.repo.owner}:dev-docs-update`,
49+
base: 'main',
50+
state: 'open'
51+
});
52+
return pulls.length > 0 ? 'exists' : 'not_exists';
53+
result-encoding: string
4054

41-
- name: Create Pull Request to main
55+
- name: Create Pull Request
56+
if: steps.check_changes.outputs.changes_detected == 'true' && steps.check_pr.outputs.result == 'not_exists'
4257
uses: peter-evans/create-pull-request@v7
4358
with:
4459
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)