87
87
node lib/node_modules/@stdlib/error/tools/pkg2id/scripts/build.js
88
88
node lib/node_modules/@stdlib/error/tools/id2pkg/scripts/build.js
89
89
90
+ # Check if there are any changes to the error databases:
91
+ - name : ' Check for changes'
92
+ id : check_changes
93
+ run : |
94
+ if [ -z "$(git diff lib/node_modules/@stdlib/error/tools/database/data/data.csv | grep '^+')" ]; then
95
+ echo "No changes detected in error databases. Skipping PR creation."
96
+ echo "has_changes=false" >> $GITHUB_OUTPUT
97
+ else
98
+ echo "Changes detected in error databases."
99
+ echo "has_changes=true" >> $GITHUB_OUTPUT
100
+ fi
101
+
90
102
# Generate comment with Markdown table of added error codes:
91
103
- name : ' Generate comment body with Markdown table of added error codes'
104
+ if : steps.check_changes.outputs.has_changes == 'true'
92
105
run : |
93
106
# Save the added lines from the diff to a temporary file:
94
107
git diff lib/node_modules/@stdlib/error/tools/database/data/data.csv | grep '^+' | sed 's/^+//' > /tmp/diff.csv
@@ -123,11 +136,13 @@ jobs:
123
136
124
137
# Disable Git hooks:
125
138
- name : ' Disable Git hooks'
139
+ if : steps.check_changes.outputs.has_changes == 'true'
126
140
run : |
127
141
rm -rf .git/hooks
128
142
129
143
# Import GPG key to sign commits:
130
144
- name : ' Import GPG key to sign commits'
145
+ if : steps.check_changes.outputs.has_changes == 'true'
131
146
# Pin action to full length commit SHA
132
147
uses : crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
133
148
with :
@@ -138,6 +153,7 @@ jobs:
138
153
139
154
# Create a pull request with the updated declarations:
140
155
- name : ' Create pull request'
156
+ if : steps.check_changes.outputs.has_changes == 'true'
141
157
id : cpr
142
158
# Pin action to full length commit SHA
143
159
uses : peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
0 commit comments