Skip to content

Commit 765a64f

Browse files
Merge branch 'develop' into object/every-in-by
Signed-off-by: Neeraj Pathak <[email protected]>
2 parents 6448c3e + 8dc22d7 commit 765a64f

File tree

464 files changed

+20299
-1903
lines changed

Some content is hidden

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

464 files changed

+20299
-1903
lines changed

.github/workflows/check_contributing_guidelines_acceptance.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ on:
4343
types:
4444
- opened
4545
- reopened
46+
- edited
4647

4748
# Global permissions:
4849
permissions:
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#/
2+
# @license Apache-2.0
3+
#
4+
# Copyright (c) 2025 The Stdlib Authors.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#/
18+
19+
# Workflow name:
20+
name: label_good_first_prs
21+
22+
# Workflow triggers:
23+
on:
24+
pull_request_target:
25+
types:
26+
- opened
27+
- closed
28+
- synchronize
29+
- reopened
30+
- edited
31+
32+
# Workflow jobs:
33+
jobs:
34+
35+
# Define a job which automatically labels pull requests based on whether they reference good first issues
36+
labeler:
37+
38+
# Define job name:
39+
name: 'Label PRs for issues with label "Good First Issue" as "Good First PR"s'
40+
41+
# Only run this job if the pull request did not have label `automated-pr`:
42+
if: contains(github.event.pull_request.labels.*.name, 'automated-pr') == false
43+
44+
# Define job permissions:
45+
permissions:
46+
contents: read
47+
pull-requests: write
48+
49+
# Define the type of virtual host machine:
50+
runs-on: ubuntu-latest
51+
52+
# Define the sequence of job steps:
53+
steps:
54+
# Checkout the repository:
55+
- name: 'Checkout repository'
56+
# Pin action to full length commit SHA
57+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
58+
with:
59+
# Specify whether to remove untracked files before checking out the repository:
60+
clean: true
61+
62+
# Limit clone depth to the most recent commit:
63+
fetch-depth: 1
64+
65+
# Specify whether to download Git-LFS files:
66+
lfs: false
67+
timeout-minutes: 10
68+
69+
# Check whether any of the referenced issues is a "Good First Issue":
70+
- name: 'Check whether any of the referenced issues is a "Good First Issue"'
71+
id: 'check-pr'
72+
env:
73+
PR_NUMBER: ${{ github.event.pull_request.number }}
74+
run: |
75+
bool=$(. "$GITHUB_WORKSPACE/.github/workflows/scripts/references_good_first_issue" $PR_NUMBER)
76+
echo "good-first-pr=$bool" >> $GITHUB_OUTPUT
77+
78+
# Add "Good First PR" label if PR references a "Good First Issue"
79+
- name: 'Add "Good First PR" label if PR references a "Good First Issue"'
80+
if: ${{ steps.check-pr.outputs.good-first-pr == 'true' }}
81+
# Pin action to full-length commit SHA
82+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
83+
with:
84+
github-token: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }}
85+
script: |
86+
const { data: pr } = await github.rest.pulls.get({
87+
'owner': context.repo.owner,
88+
'repo': context.repo.repo,
89+
'pull_number': context.payload.pull_request.number
90+
});
91+
const labels = context.payload.pull_request.labels.map( label => label.name );
92+
if ( !labels.includes( 'Good First PR' ) ) {
93+
await github.rest.issues.addLabels({
94+
'owner': context.repo.owner,
95+
'repo': context.repo.repo,
96+
'issue_number': context.payload.pull_request.number,
97+
'labels': [ 'Good First PR' ]
98+
});
99+
}

.github/workflows/lint_pr_title.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ on:
2626
- synchronize
2727
- opened
2828
- reopened
29+
- edited
2930

3031
# Global permissions:
3132
permissions:

.github/workflows/lint_random_files.yml

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,12 @@ jobs:
294294
295295
# Lint JavaScript files:
296296
- name: 'Lint JavaScript files'
297+
id: lint-javascript
297298
if: ( github.event.inputs.javascript != 'false' ) && ( success() || failure() )
298299
run: |
300+
# If any command in a pipeline fails, the entire pipeline should fail:
301+
set -o pipefail
302+
299303
# Determine root directory:
300304
root=$(git rev-parse --show-toplevel)
301305
@@ -315,45 +319,81 @@ jobs:
315319
FIX=0
316320
fi
317321
322+
# Combined error file:
323+
ERR_FILE="lint_javascript_errors.txt"
324+
> "$ERR_FILE" # Initialize a clean file
325+
318326
# Lint JavaScript source files:
319327
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '\.js$' | grep -v -e '/examples' -e '/test' -e '/benchmark' -e '^dist/' | tr '\n' ' ')
320328
321329
# Build native addons if present:
322330
packages=$(echo "${files}" | tr ' ' '\n' | sed 's/^lib\/node_modules\///g' | sed 's/\/lib\/.*//g' | sort | uniq)
323331
for pkg in ${packages}; do
324-
if [ -f "lib/node_modules/${pkg}/binding.gyp" ]; then
325-
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
326-
fi
332+
if [ -f "lib/node_modules/${pkg}/binding.gyp" ]; then
333+
NODE_ADDONS_PATTERN="${pkg}" make install-node-addons
334+
fi
327335
done
328336
329337
if [[ -n "${files}" ]]; then
330-
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}"
338+
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}" 2>&1 | tee -a "$ERR_FILE"
331339
fi
332340
333341
# Lint JavaScript command-line interfaces...
334342
file=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '\.js$' | grep -E '/bin/cli$' | tr '\n' ' ')
335343
if [[ -n "${file}" ]]; then
336-
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${file}"
344+
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${file}" 2>&1 | tee -a "$ERR_FILE"
337345
fi
338346
339347
# Lint JavaScript example files:
340348
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/examples/.*\.js$' | tr '\n' ' ')
341349
if [[ -n "${files}" ]]; then
342-
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}" ESLINT_CONF="${eslint_examples_conf}"
350+
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}" ESLINT_CONF="${eslint_examples_conf}" 2>&1 | tee -a "$ERR_FILE"
343351
fi
344352
345353
# Lint JavaScript test files:
346354
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/test/.*\.js$' | tr '\n' ' ')
347355
if [[ -n "${files}" ]]; then
348-
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}" ESLINT_CONF="${eslint_tests_conf}"
356+
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}" ESLINT_CONF="${eslint_tests_conf}" 2>&1 | tee -a "$ERR_FILE"
349357
fi
350358
351359
# Lint JavaScript benchmark files:
352360
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep '/benchmark/.*\.js$' | tr '\n' ' ')
353361
if [[ -n "${files}" ]]; then
354-
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}" ESLINT_CONF="${eslint_benchmarks_conf}"
362+
make lint-javascript-files FIX="${FIX}" FAST_FAIL=0 FILES="${files}" ESLINT_CONF="${eslint_benchmarks_conf}" 2>&1 | tee -a "$ERR_FILE"
355363
fi
356364
365+
# Create sub-issue for JavaScript lint failures:
366+
- name: 'Create sub-issue for JavaScript lint failures'
367+
if: failure() && contains(steps.lint-javascript.outcome, 'failure')
368+
env:
369+
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }}
370+
run: |
371+
BODY_FILE="$GITHUB_WORKSPACE/lint_issue_body.md"
372+
cat << EOF > "$BODY_FILE"
373+
## JavaScript Linting Failures
374+
375+
Linting failures were detected in the automated JavaScript lint workflow run.
376+
377+
### Workflow Details
378+
379+
- Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
380+
- Type: JavaScript Linting
381+
- Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
382+
383+
### Error Details
384+
\`\`\`
385+
$(cat lint_javascript_errors.txt)
386+
\`\`\`
387+
EOF
388+
389+
. "$GITHUB_WORKSPACE/.github/workflows/scripts/create_sub_issue" \
390+
'Fix JavaScript lint errors' \
391+
"$BODY_FILE" \
392+
"5377" \
393+
"Good First Issue"
394+
395+
rm "$BODY_FILE"
396+
357397
# Lint Python files:
358398
- name: 'Lint Python files'
359399
if: ( github.event.inputs.python != 'false' ) && ( success() || failure() )
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
#!/usr/bin/env bash
2+
#
3+
# @license Apache-2.0
4+
#
5+
# Copyright (c) 2025 The Stdlib Authors.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
# Script to check whether a PR references an issue with label "Good First Issue".
20+
#
21+
# Usage: references_good_first_issue <pr_number>
22+
#
23+
# Arguments:
24+
#
25+
# pr_number Pull request number.
26+
#
27+
# Environment variables:
28+
#
29+
# GITHUB_TOKEN GitHub token for authentication.
30+
31+
# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails:
32+
set -o pipefail
33+
34+
35+
# VARIABLES #
36+
37+
# Resolve the pull request number:
38+
pr_number="$1"
39+
40+
# GitHub API base URL:
41+
github_api_url="https://api.github.com"
42+
43+
# Repository owner and name:
44+
repo_owner="stdlib-js"
45+
repo_name="stdlib"
46+
47+
48+
# FUNCTIONS #
49+
50+
# Error handler.
51+
#
52+
# $1 - error status
53+
on_error() {
54+
echo 'ERROR: An error was encountered during execution.' >&2
55+
exit "$1"
56+
}
57+
58+
# Performs a GitHub API request.
59+
#
60+
# $1 - HTTP method (GET or POST)
61+
# $2 - API endpoint
62+
# $3 - data for POST requests
63+
github_api() {
64+
local method="$1"
65+
local endpoint="$2"
66+
local data="$3"
67+
68+
# Initialize an array to hold curl headers:
69+
local headers=()
70+
71+
# If GITHUB_TOKEN is set, add the Authorization header:
72+
if [ -n "${GITHUB_TOKEN}" ]; then
73+
headers+=("-H" "Authorization: token ${GITHUB_TOKEN}")
74+
fi
75+
76+
# Determine the HTTP method and construct the curl command accordingly...
77+
case "${method}" in
78+
GET)
79+
curl -s "${headers[@]}" "${github_api_url}${endpoint}"
80+
;;
81+
POST)
82+
# For POST requests, always set the Content-Type header:
83+
headers+=("-H" "Content-Type: application/json")
84+
85+
# If data is provided, include it in the request:
86+
if [ -n "${data}" ]; then
87+
curl -s -X POST "${headers[@]}" -d "${data}" "${github_api_url}${endpoint}"
88+
else
89+
# Handle cases where POST data is required but not provided:
90+
echo "ERROR: POST request requires data."
91+
on_error 1
92+
fi
93+
;;
94+
*)
95+
echo "ERROR: Invalid HTTP method: ${method}."
96+
on_error 1
97+
;;
98+
esac
99+
}
100+
101+
# Main execution sequence.
102+
main() {
103+
local issue_numbers
104+
local issue_details
105+
local pr_details
106+
local pr_body
107+
local issue
108+
local bool
109+
110+
if [ -z "${pr_number}" ]; then
111+
echo "ERROR: Pull request number is required." >&2
112+
on_error 1
113+
fi
114+
115+
# Fetch pull request details:
116+
pr_details=$(github_api "GET" "/repos/${repo_owner}/${repo_name}/pulls/${pr_number}")
117+
pr_body=$(echo "${pr_details}" | jq -r '.body')
118+
119+
issue_numbers=$(echo "${pr_body}" | grep -Ei '#[0-9]+' | grep -oEi '[0-9]+' | sort | uniq)
120+
if [ -z "${issue_numbers}" ]; then
121+
echo 'false'
122+
exit 0
123+
fi
124+
125+
for issue in ${issue_numbers}; do
126+
issue_details=$(github_api "GET" "/repos/${repo_owner}/${repo_name}/issues/${issue}")
127+
128+
bool=$(echo "${issue_details}" | jq '.labels | any(.name == "Good First Issue")')
129+
if [ "${bool}" == 'true' ]; then
130+
echo 'true'
131+
exit 0
132+
fi
133+
done
134+
135+
echo 'false'
136+
exit 0
137+
}
138+
139+
main

.mailmap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ Naresh Jagadeesan <[email protected]> <[email protected].
123123

124124
Naveen Kumar <[email protected]> naveen
125125

126+
127+
Neeraj Pathak <[email protected]> Neerajpathak07
128+
126129
Nishant Shinde <[email protected]> nishant-s7
127130

128131
Nithin Katta <[email protected]> KATTA NAGA NITHIN

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ Yaswanth Kosuru <[email protected]>
135135
Yernar Yergaziyev <[email protected]>
136136
Yuvi Mittal <[email protected]>
137137
ekambains <[email protected]>
138+
fadiothman22 <[email protected]>
138139
olenkabilonizhka <[email protected]>
139140
pranav-1720 <[email protected]>
140141

0 commit comments

Comments
 (0)