Skip to content

Commit bb52671

Browse files
Merge branch 'heavisidef' of https://github.com/vivekmaurya001/stdlib into heavisidef
2 parents 685cf22 + ffe9a5d commit bb52671

File tree

219 files changed

+6663
-717
lines changed

Some content is hidden

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

219 files changed

+6663
-717
lines changed

.github/workflows/labeler.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ name: labeler
2222
# Workflow triggers:
2323
on:
2424
pull_request_target:
25+
types:
26+
- opened
27+
- synchronize
28+
- reopened
29+
- edited
30+
- review_requested
31+
- review_request_removed
32+
- ready_for_review
33+
- converted_to_draft
34+
- labeled
2535

2636
# Workflow jobs:
2737
jobs:
@@ -53,3 +63,73 @@ jobs:
5363
with:
5464
configuration-path: .github/labeler.yml
5565
repo-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
66+
67+
# Add "Needs Review" label when PR is opened and not a draft:
68+
- name: 'Add "Needs Review" label if PR is opened and not draft'
69+
if: ${{ github.event.action == 'opened' && github.event.pull_request.draft == false }}
70+
# Pin action to full length commit SHA
71+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
72+
with:
73+
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
74+
script: |
75+
await github.rest.issues.addLabels({
76+
'owner': context.repo.owner,
77+
'repo': context.repo.repo,
78+
'issue_number': context.payload.pull_request.number,
79+
'labels': [ 'Needs Review' ]
80+
})
81+
82+
# Add "Needs Review" label when PR is marked ready for review or review is requested:
83+
- name: 'Add "Needs Review" label if PR is ready for review or review is requested'
84+
if: ${{ github.event.action == 'ready_for_review' || github.event.action == 'review_requested' }}
85+
# Pin action to full length commit SHA
86+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
87+
with:
88+
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
89+
script: |
90+
await github.rest.issues.addLabels({
91+
'owner': context.repo.owner,
92+
'repo': context.repo.repo,
93+
'issue_number': context.payload.pull_request.number,
94+
'labels': [ 'Needs Review' ]
95+
})
96+
97+
# Remove "Needs Review" label when PR is converted to draft or closed:
98+
- name: 'Remove "Needs Review" label if PR is converted to draft or closed'
99+
if: ${{ github.event.action == 'converted_to_draft' || github.event.action == 'closed' }}
100+
# Pin action to full length commit SHA
101+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
102+
with:
103+
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
104+
script: |
105+
try {
106+
await github.rest.issues.removeLabel({
107+
'owner': context.repo.owner,
108+
'repo': context.repo.repo,
109+
'issue_number': context.payload.pull_request.number,
110+
'name': 'Needs Review'
111+
})
112+
} catch ( error ) {
113+
console.log( 'Error removing label: %s', error.message );
114+
}
115+
116+
# Remove "Needs Review" and "Needs Changes" labels when "Ready To Merge" is assigned:
117+
- name: 'Remove "Needs Review" and "Needs Changes" labels when "Ready To Merge" is assigned'
118+
if: ${{ github.event.action == 'labeled' && github.event.label.name == 'Ready To Merge' }}
119+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
120+
with:
121+
github-token: ${{ secrets.CHATBOT_GITHUB_TOKEN }}
122+
script: |
123+
const labelsToRemove = [ 'Needs Review', 'Needs Changes' ];
124+
for ( const label of labelsToRemove ) {
125+
try {
126+
await github.rest.issues.removeLabel({
127+
'owner': context.repo.owner,
128+
'repo': context.repo.repo,
129+
'issue_number': context.payload.pull_request.number,
130+
'name': label
131+
})
132+
} catch ( error ) {
133+
console.log( 'Error removing label %s: %s', label, error.message );
134+
}
135+
}

.github/workflows/lint_changed_files.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,7 @@ jobs:
142142
- name: 'Lint package.json files'
143143
if: success() || failure()
144144
run: |
145-
# Determine root directory:
146-
root=$(git rev-parse --show-toplevel)
147-
148-
# Define the path to a utility for linting package.json files:
149-
lint_package_json="${root}/lib/node_modules/@stdlib/_tools/lint/pkg-json/bin/cli"
150-
151-
files=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$' | tr '\n' ' ' | sed 's/ $//')
152-
if [ -n "${files}" ]; then
153-
echo "Linting package.json files that have changed..."
154-
printf "${files}" | "${lint_package_json}" --split=" "
155-
else
156-
echo "No package.json files to lint."
157-
fi
145+
. "$GITHUB_WORKSPACE/.github/workflows/scripts/lint_package_json_files" "${{ steps.changed-files.outputs.files }}"
158146
159147
# Lint REPL help files...
160148
- name: 'Lint REPL help files'
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env bash
2+
#
3+
# @license Apache-2.0
4+
#
5+
# Copyright (c) 2024 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 lint package.json files and check/update metadata fields.
20+
#
21+
# Usage: lint_package_json_files file1 [file2 file3 ...]
22+
#
23+
# Arguments:
24+
#
25+
# file1 File path.
26+
# file2 File path.
27+
# file3 File path.
28+
29+
# Determine root directory:
30+
root=$(git rev-parse --show-toplevel)
31+
32+
# Define the path to a utility for linting package.json files:
33+
lint_package_json="${root}/lib/node_modules/@stdlib/_tools/lint/pkg-json/bin/cli"
34+
35+
# Define paths to utilities for updating package.json metadata fields:
36+
update_package_json_directories="${root}/lib/node_modules/@stdlib/_tools/package-json/scripts/update_directories"
37+
update_package_json_gypfile="${root}/lib/node_modules/@stdlib/_tools/package-json/scripts/update_gypfile"
38+
39+
# Files to process:
40+
files_to_process="$*"
41+
42+
# Lint package.json files:
43+
files=$(echo "${files_to_process}" | tr ' ' '\n' | grep 'package\.json$' | grep -v 'datapackage\.json$' | tr '\n' ' ' | sed 's/ $//')
44+
if [ -n "${files}" ]; then
45+
echo "Linting package.json files..."
46+
printf '%s' "${files}" | "${lint_package_json}" --split=" "
47+
else
48+
echo "No package.json files to lint."
49+
fi
50+
51+
# Check if metadata fields need to be updated in package.json files of affected packages:
52+
dirs=$(echo "${files_to_process}" | tr ' ' '\n' | \
53+
xargs dirname | \
54+
sed -E 's/\/(benchmark|bin|data|docs|etc|examples|include|lib|scripts|src|test)(\/.*)?$//' | \
55+
sort -u)
56+
57+
echo "Checking package.json files in directories: ${dirs}"
58+
59+
needs_changes=0
60+
for dir in ${dirs}; do
61+
echo "Checking package.json in ${dir}..."
62+
package_json="${dir}/package.json"
63+
if [ ! -f "${package_json}" ]; then
64+
continue
65+
fi
66+
original_content=$(cat "${package_json}")
67+
68+
"${update_package_json_directories}" "${dir}"
69+
"${update_package_json_gypfile}" "${dir}"
70+
71+
new_content=$(cat "${package_json}")
72+
if [ "$original_content" != "$new_content" ]; then
73+
echo "ERROR: package.json in ${dir} needs updates to directories and/or gypfile fields"
74+
git --no-pager diff "${package_json}"
75+
needs_changes=1
76+
fi
77+
done
78+
79+
# Exit with failure if any needed changes were detected:
80+
if [ $needs_changes -eq 1 ]; then
81+
exit 1
82+
fi

.github/workflows/slash_commands.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ jobs:
5151
github-token: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }}
5252
script: |
5353
github.rest.issues.addLabels({
54-
owner: context.repo.owner,
55-
repo: context.repo.repo,
56-
issue_number: context.issue.number,
57-
labels: ['bot: In Progress']
54+
'owner': context.repo.owner,
55+
'repo': context.repo.repo,
56+
'issue_number': context.issue.number,
57+
'labels': ['bot: In Progress']
5858
})
5959
6060
# Add initial reaction to comment with slash command:
@@ -254,11 +254,11 @@ jobs:
254254
script: |
255255
try {
256256
await github.rest.issues.removeLabel({
257-
owner: context.repo.owner,
258-
repo: context.repo.repo,
259-
issue_number: context.issue.number,
260-
name: 'bot: In Progress'
257+
'owner': context.repo.owner,
258+
'repo': context.repo.repo,
259+
'issue_number': context.issue.number,
260+
'name': 'bot: In Progress'
261261
})
262-
} catch (error) {
263-
console.log( 'Error removing label:', error );
262+
} catch ( error ) {
263+
console.log( 'Error removing label: %s', error.message );
264264
}

.github/workflows/standalone_keepalive.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ name: standalone_keepalive
2121

2222
# Workflow triggers:
2323
on:
24-
# Run the workflow on the first day of each month:
24+
# Run the workflow on the first day of each week:
2525
schedule:
26-
- cron: '0 0 1 * *'
26+
- cron: '0 0 * * 1'
2727

2828
# Allow the workflow to be manually run:
2929
workflow_dispatch:

.github/workflows/update_error_databases.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,21 @@ jobs:
8787
node lib/node_modules/@stdlib/error/tools/pkg2id/scripts/build.js
8888
node lib/node_modules/@stdlib/error/tools/id2pkg/scripts/build.js
8989
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+
90102
# Generate comment with Markdown table of added error codes:
91103
- name: 'Generate comment body with Markdown table of added error codes'
104+
if: steps.check_changes.outputs.has_changes == 'true'
92105
run: |
93106
# Save the added lines from the diff to a temporary file:
94107
git diff lib/node_modules/@stdlib/error/tools/database/data/data.csv | grep '^+' | sed 's/^+//' > /tmp/diff.csv
@@ -123,11 +136,13 @@ jobs:
123136

124137
# Disable Git hooks:
125138
- name: 'Disable Git hooks'
139+
if: steps.check_changes.outputs.has_changes == 'true'
126140
run: |
127141
rm -rf .git/hooks
128142
129143
# Import GPG key to sign commits:
130144
- name: 'Import GPG key to sign commits'
145+
if: steps.check_changes.outputs.has_changes == 'true'
131146
# Pin action to full length commit SHA
132147
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
133148
with:
@@ -138,6 +153,7 @@ jobs:
138153

139154
# Create a pull request with the updated declarations:
140155
- name: 'Create pull request'
156+
if: steps.check_changes.outputs.has_changes == 'true'
141157
id: cpr
142158
# Pin action to full length commit SHA
143159
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5

.mailmap

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ Adarsh Palaskar <[email protected]> adarshpalaskar1
2020
2121
Aditya Sapra <[email protected]> adityacodes30
2222

23+
Ahmed Atwa <[email protected]> NightKnight
24+
25+
26+
Ahmed Kashkoush <[email protected]> Ahmed_Kashkoush
27+
2328
2429
Aman Bhansali <[email protected]> aman-095
2530

@@ -83,6 +88,8 @@ Karthik Prakash <[email protected]> skoriop
8388

8489
# M
8590

91+
Manvith M <[email protected]> Manvith
92+
8693
Marcus Fantham <[email protected]> Marcus
8794

8895
@@ -99,10 +106,17 @@ Muhammad Haris <[email protected]> headlessNode
99106

100107
101108

109+
Nishant Shinde <[email protected]> nishant-s7
110+
102111
Nithin Katta <[email protected]> KATTA NAGA NITHIN
103112

113+
# O
114+
115+
Ori Miles <[email protected]> orimiles5
116+
104117
# P
105118

119+
Philipp Burckhardt <[email protected]> <[email protected]>
106120
Philipp Burckhardt <[email protected]> Planeshifter
107121

108122
@@ -117,6 +131,8 @@ Pratyush Kumar Chouhan <[email protected]> Pratyush
117131

118132
Priyansh <[email protected]> itsspriyansh
119133

134+
Priyanshu Agarwal <[email protected]> AgPriyanshu18
135+
120136
Pushpendra Chandravanshi <[email protected]> <[email protected]>
121137
Pushpendra Chandravanshi <[email protected]> Pushpendra766
122138

@@ -132,16 +148,20 @@ Rejoan Sardar <[email protected]> Rejoan-Sardar
132148
133149
134150

151+
Rishav <[email protected]> RISHAV
152+
135153
Robert Gislason <[email protected]> rgizz
136154

137-
Rutam <[email protected]> performant23
155+
Rutam Kathale <[email protected]> performant23
138156

139157
Ryan Seal <[email protected]> Splrk
140158

141159
# S
142160

143161
Sai Srikar Dumpeti <[email protected]> the-r3aper7
144162

163+
Sarthak Paandey <[email protected]> SarthakPaandey
164+
145165
Shashank Shekhar Singh <[email protected]> <[email protected]>
146166
Shashank Shekhar Singh <[email protected]> Shashankss1205
147167

@@ -160,6 +180,8 @@ Stephannie Jiménez Gacha <[email protected]> <[email protected].
160180
Stephannie Jiménez Gacha <[email protected]> Stephannie Jimenez
161181
Stephannie Jiménez Gacha <[email protected]> Stephannie Jimenez Gacha
162182

183+
Suraj Kumar <[email protected]> Suraj kuma
184+
163185
# T
164186

165187
Tudor Pagu <[email protected]> tudor-pagu
@@ -184,5 +206,7 @@ Varad Gupta <[email protected]> vr-varad
184206

185207
# Y
186208

209+
Yaswanth Kosuru <[email protected]> yaswanth
210+
187211
188212

0 commit comments

Comments
 (0)