Skip to content

Commit d756bdf

Browse files
committed
Add conditions to not error on empty runs
1 parent 8ce7420 commit d756bdf

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

.github/workflows/check_required_files.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ jobs:
7373
7474
# Configure git:
7575
- name: 'Configure git'
76+
if: steps.check-reviewers.outputs.is_stdlib_bot == 'true'
7677
run: |
7778
git config --local user.email "noreply@stdlib.io"
7879
git config --local user.name "stdlib-bot"
@@ -200,6 +201,7 @@ jobs:
200201

201202
# Create a comment on the pull request informing the user whether the pull request is missing required files:
202203
- name: 'Create a comment on the pull request informing the user whether the pull request is missing required files'
204+
if: steps.check-reviewers.outputs.is_stdlib_bot == 'true'
203205
uses: peter-evans/create-or-update-comment@v1
204206
with:
205207
# Specify the issue or pull request number:

.github/workflows/markdown_equations.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,43 @@ jobs:
9696

9797
# Generate SVG equations:
9898
- name: 'Generate SVG equations'
99+
id: svg-equations
99100
run: |
100101
make markdown-svg-equations-files FILES="${{ steps.changed.outputs.files }}"
101-
git add -A && git commit -m "Add SVG equations"
102+
103+
if [[ -z "$(git status --porcelain)" ]]; then
104+
# If no files were changed, exit with a success status code:
105+
echo "::set-output name=changed::false"
106+
exit 0
107+
else
108+
# Otherwise, add changed files to the staging area and commit:
109+
git add -A && git commit -m "Add SVG equations"
110+
echo "::set-output name=changed::true"
111+
fi
102112
timeout-minutes: 15
103113

104114
# Update Markdown equation elements:
105115
- name: 'Update equation elements'
116+
id: equation-elements
106117
run: |
107118
make markdown-img-equations-files FILES="${{ steps.changed.outputs.files }}"
108119
make markdown-img-equations-src-urls-files FILES="${{ steps.changed.outputs.files }}"
109-
git add -A && git commit -m "Update Markdown equation elements"
120+
121+
if [[ -z "$(git status --porcelain)" ]]; then
122+
# If no files were changed, exit with a success status code:
123+
echo "::set-output name=changed::false"
124+
exit 0
125+
else
126+
# Otherwise, add changed files to the staging area and commit:
127+
git add -A && git commit -m "Update Markdown equation elements"
128+
echo "::set-output name=changed::true"
129+
fi
110130
timeout-minutes: 15
111131

112132
# Create a pull request with the updated equations:
113133
- name: 'Create pull request'
114134
id: cpr
135+
if: steps.svg-equations.outputs.changed == 'true' || steps.equation-elements.outputs.changed == 'true'
115136
uses: peter-evans/create-pull-request@v3
116137
with:
117138
title: 'Update Markdown equation elements'
@@ -132,6 +153,7 @@ jobs:
132153

133154
# Create Markdown summary of the pull request:
134155
- name: 'Create summary'
156+
if: steps.svg-equations.outputs.changed == 'true' || steps.equation-elements.outputs.changed == 'true'
135157
run: |
136158
echo "# :tada: Pull Request created! :tada:" >> $GITHUB_STEP_SUMMARY
137159
echo "" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)