Skip to content

Commit 685fc10

Browse files
committed
Merge branch 'develop' of https://github.com/stdlib-js/stdlib into refactor/plot
2 parents 788e120 + c4cc264 commit 685fc10

File tree

336 files changed

+18907
-719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

336 files changed

+18907
-719
lines changed

.github/workflows/pr_commands_comment.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ on:
2929
description: 'Pull request number'
3030
required: true
3131
type: number
32+
debug:
33+
description: 'Enable debug output'
34+
required: false
35+
default: false
36+
type: boolean
3237

3338
# Define the secrets accessible by the workflow:
3439
secrets:
@@ -43,6 +48,14 @@ on:
4348
description: 'Pull request number'
4449
required: true
4550
type: number
51+
debug:
52+
description: 'Enable debug output'
53+
required: false
54+
default: 'false'
55+
type: choice
56+
options:
57+
- 'true'
58+
- 'false'
4659

4760
# Global permissions:
4861
permissions:
@@ -63,11 +76,23 @@ jobs:
6376

6477
# Define the sequence of job steps...
6578
steps:
79+
# Checkout the repository:
80+
- name: 'Checkout repository'
81+
# Pin action to full length commit SHA
82+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
83+
with:
84+
# Ensure we have access to the scripts directory:
85+
sparse-checkout: |
86+
.github/workflows/scripts
87+
sparse-checkout-cone-mode: false
88+
timeout-minutes: 10
6689

6790
# Leave comment with package make command instructions:
6891
- name: 'Leave comment with package make command instructions'
6992
env:
7093
PR_NUMBER: ${{ inputs.pull_request_number }}
94+
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN || secrets.STDLIB_BOT_PAT_REPO_WRITE }}
95+
DEBUG: ${{ inputs.debug || 'false' }}
7196
run: |
7297
. "$GITHUB_WORKSPACE/.github/workflows/scripts/package_commands_comment" "$PR_NUMBER"
7398
timeout-minutes: 30

.github/workflows/scripts/package_commands_comment

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# Environment variables:
2828
#
2929
# GITHUB_TOKEN GitHub token for authentication.
30+
# DEBUG Whether to enable verbose debug output. Default: `false`.
3031

3132
# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails:
3233
set -o pipefail
@@ -44,9 +45,22 @@ github_api_url="https://api.github.com"
4445
repo_owner="stdlib-js"
4546
repo_name="stdlib"
4647

48+
# Set debug mode:
49+
debug="${DEBUG:-false}"
50+
4751

4852
# FUNCTIONS #
4953

54+
# Prints debug messages if DEBUG environment variable is set to "true".
55+
#
56+
# $1 - debug message
57+
debug_log() {
58+
# Only print debug messages if DEBUG environment variable is set to "true":
59+
if [ "$debug" = true ]; then
60+
echo "[DEBUG] $1" >&2
61+
fi
62+
}
63+
5064
# Error handler.
5165
#
5266
# $1 - error status
@@ -70,6 +84,8 @@ github_api() {
7084
local endpoint="$2"
7185
local data="$3"
7286

87+
debug_log "Making API request: ${method} ${endpoint}"
88+
7389
# Initialize an array to hold curl headers:
7490
local headers=()
7591

@@ -117,12 +133,20 @@ main() {
117133
on_error 1
118134
fi
119135

136+
debug_log "Processing PR #${pr_number}"
137+
120138
# Fetch changed files in pull request:
121139
response=$(github_api "GET" "/repos/${repo_owner}/${repo_name}/pulls/${pr_number}/files?per_page=100")
122140
files=$(echo "${response}" | jq -r '.[] | .filename')
141+
debug_log "Found $(echo "${files}" | wc -l) changed files"
123142

124143
# Extract files associated with native add-ons:
125-
c_files=$(echo "${files}" | grep -e '/benchmark/c' -e '/examples/c' -e '/binding.gyp' -e '/include.gypi' -e '/src/')
144+
c_files=$(echo "${files}" | grep -e '/benchmark/c' -e '/examples/c' -e '/binding.gyp' -e '/include.gypi' -e '/src/' || true)
145+
if [[ -z "${c_files}" ]]; then
146+
debug_log "No native add-on files found"
147+
else
148+
debug_log "Found native add-on files: $(echo "${c_files}" | wc -l) files"
149+
fi
126150

127151
# Find unique package directories:
128152
directories=$(echo "${files}" | tr ' ' '\n' | \
@@ -133,6 +157,7 @@ main() {
133157

134158
# Extract package names from changed package directories (e.g., @stdlib/math/base/special/sin) by removing the leading 'lib/node_modules/':
135159
packages=$(echo "${directories}" | sed -E 's/^lib\/node_modules\///')
160+
debug_log "Found packages: $(echo "${packages}" | tr '\n' ' ')"
136161

137162
# Documentation links:
138163
docs_links="
@@ -148,9 +173,11 @@ main() {
148173

149174
# Count the number of packages:
150175
package_count=$(echo "${packages}" | wc -l)
176+
debug_log "Package count: ${package_count}"
151177

152178
if [[ $package_count -gt 1 ]]; then
153179
# Multiple packages case:
180+
debug_log "Multiple packages detected, generating multi-package comment"
154181
comment="Hello! 👋
155182
156183
Pro-tip: This PR changes multiple packages. You can use various \`make\` rules with \`*_FILTER\` environment variables to run tests, benchmarks, and examples for specific packages.
@@ -174,7 +201,9 @@ ${docs_links}"
174201

175202
else
176203
# Single package case:
177-
if [[ "${#c_files[@]}" -eq 0 ]]; then
204+
debug_log "Single package detected: ${packages}"
205+
if [[ -z "${c_files}" ]]; then
206+
debug_log "No C files found, generating JS-only comment"
178207
comment="Hello! 👋
179208
180209
Pro-tip: Use the \`make\` commands below during local development to ensure that all tests, examples, and benchmark files in your PR run successfully.
@@ -200,6 +229,7 @@ make examples EXAMPLES_FILTER=\".*/${packages}/.*\"
200229
\`\`\`
201230
${docs_links}"
202231
else
232+
debug_log "C files found, generating native addon comment"
203233
comment="Hello! 👋
204234
205235
Pro-tip: Use the \`make\` below commands during local development to ensure that all tests, examples, and benchmark files in your PR run successfully.
@@ -241,10 +271,12 @@ ${docs_links}"
241271
fi
242272
fi
243273

274+
debug_log "Posting comment on PR #${pr_number}"
244275
if ! github_api "POST" "/repos/${repo_owner}/${repo_name}/issues/${pr_number}/comments" "{\"body\":$(echo "${comment}" | jq -R -s -c .)}"; then
245276
echo "Failed to post comment on PR."
246277
on_error 1
247278
fi
279+
debug_log "Successfully posted comment on PR #${pr_number}"
248280

249281
print_success
250282
exit 0

lib/node_modules/@stdlib/assert/has-map-support/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* var hasMapSupport = require( '@stdlib/assert/has-map-support' );
2828
*
2929
* var bool = hasMapSupport();
30-
* // returns <Boolean>
30+
* // returns <boolean>
3131
*/
3232

3333
// MODULES //

lib/node_modules/@stdlib/assert/has-set-support/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* var hasSetSupport = require( '@stdlib/assert/has-set-support' );
2828
*
2929
* var bool = hasSetSupport();
30-
* // returns <Boolean>
30+
* // returns <boolean>
3131
*/
3232

3333
// MODULES //

lib/node_modules/@stdlib/assert/is-accessor-array/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @module @stdlib/assert/is-accessor-array
2525
*
2626
* @example
27-
* var Complex128Array = require( '@stdlib/array/complex128array' );
27+
* var Complex128Array = require( '@stdlib/array/complex128' );
2828
* var isAccessorArray = require( '@stdlib/assert/is-accessor-array' );
2929
*
3030
* var bool = isAccessorArray( new Complex128Array( 10 ) );

lib/node_modules/@stdlib/assert/is-arraybuffer-view/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
* @module @stdlib/assert/is-arraybuffer-view
2525
*
2626
* @example
27-
* var isArrayBufferView = require( '@stdlib/assert/is-arraybuffer-view' );
2827
* var Int32Array = require( '@stdlib/array/int32' );
28+
* var isArrayBufferView = require( '@stdlib/assert/is-arraybuffer-view' );
2929
*
3030
* var bool = isArrayBufferView( new Int32Array( 10 ) );
3131
* // returns true

lib/node_modules/@stdlib/assert/is-circular-plain-object/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* @module @stdlib/assert/is-circular-plain-object
2525
*
2626
* @example
27-
* var isCircular = require( '@stdlib/assert/is-circular-plain-object' );
27+
* var isCircularPlainObject = require( '@stdlib/assert/is-circular-plain-object' );
2828
*
2929
* var obj = {
3030
* 'a': 'beep',

0 commit comments

Comments
 (0)