-
-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stdlib-js:develop' into dtrmv
- Loading branch information
Showing
3,115 changed files
with
83,761 additions
and
20,826 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
.github/workflows/check_contributing_guidelines_acceptance.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#/ | ||
# @license Apache-2.0 | ||
# | ||
# Copyright (c) 2024 The Stdlib Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#/ | ||
|
||
# Workflow name: | ||
name: check_contributing_guidelines_acceptance | ||
|
||
# Workflow triggers: | ||
on: | ||
# Allow the workflow to be triggered by other workflows | ||
workflow_call: | ||
# Define the input parameters for the workflow: | ||
inputs: | ||
pull_request_number: | ||
description: 'Pull request number' | ||
required: true | ||
type: number | ||
user: | ||
required: true | ||
type: string | ||
# Define the secrets accessible by the workflow: | ||
secrets: | ||
STDLIB_BOT_GITHUB_TOKEN: | ||
description: 'stdlib-bot GitHub token to create pull request comments' | ||
required: true | ||
|
||
# Trigger on pull request events: | ||
pull_request_target: | ||
types: [opened, reopened] | ||
|
||
# Global permissions: | ||
permissions: | ||
# Allow read-only access to the repository contents: | ||
contents: read | ||
|
||
# Allow write access to pull requests: | ||
pull-requests: write | ||
|
||
# Workflow jobs: | ||
jobs: | ||
|
||
# Define a job for checking the contributing guidelines acceptance... | ||
check_acknowledgment: | ||
|
||
# Define a display name: | ||
name: 'Check Contributing Guidelines Acceptance' | ||
|
||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
|
||
# Skip this job for PRs opened by the stdlib-bot: | ||
if: github.event.pull_request.user.login != 'stdlib-bot' | ||
|
||
# Define the sequence of job steps... | ||
steps: | ||
# Checkout the repository: | ||
- name: 'Checkout repository' | ||
# Pin action to full length commit SHA | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
# Specify whether to remove untracked files before checking out the repository: | ||
clean: true | ||
|
||
# Limit clone depth to the most recent commit: | ||
fetch-depth: 1 | ||
|
||
# Specify whether to download Git-LFS files: | ||
lfs: false | ||
timeout-minutes: 10 | ||
|
||
# Check contributing guidelines acceptance: | ||
- name: 'Check contributing guidelines acceptance' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_GITHUB_TOKEN }} | ||
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pull_request_number }} | ||
run: | | ||
. "$GITHUB_WORKSPACE/.github/workflows/scripts/check_contributing_guidelines_acceptance" $PR_NUMBER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
.github/workflows/scripts/check_contributing_guidelines_acceptance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# @license Apache-2.0 | ||
# | ||
# Copyright (c) 2024 The Stdlib Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Script to check if a pull request contains the checked contributing guidelines acknowledgment checkbox. | ||
# | ||
# Usage: check_contributing_guidelines PR_NUMBER | ||
# | ||
# Arguments: | ||
# | ||
# PR_NUMBER Pull request number. | ||
# | ||
# Environment variables: | ||
# | ||
# GITHUB_TOKEN GitHub token for authentication. | ||
|
||
# Ensure that the exit status of pipelines is non-zero in the event that at least one of the commands in a pipeline fails: | ||
set -o pipefail | ||
|
||
|
||
# VARIABLES # | ||
|
||
# Get the pull request number: | ||
pr_number="$1" | ||
|
||
# Set the repository name: | ||
GITHUB_REPOSITORY="stdlib-js/stdlib" | ||
|
||
|
||
# FUNCTIONS # | ||
|
||
# Error handler. | ||
# | ||
# $1 - error status | ||
on_error() { | ||
echo 'ERROR: An error was encountered during execution.' >&2 | ||
exit "$1" | ||
} | ||
|
||
# Prints a success message. | ||
print_success() { | ||
echo 'Success!' >&2 | ||
} | ||
|
||
# Main execution sequence. | ||
main() { | ||
echo "Checking contributing guidelines acknowledgment for PR #${pr_number}..." | ||
|
||
# Fetch the pull request body: | ||
if ! pr_body=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" \ | ||
"https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${pr_number}" | \ | ||
jq -r .body); then | ||
echo "Failed to fetch PR body." | ||
on_error 1 | ||
fi | ||
|
||
# Check for the contributing guidelines checkbox: | ||
if echo "${pr_body}" | grep -qE '^\s*-\s*\[x\]\s*Read,\s*understood,\s*and\s*followed\s*the\s*\[contributing\s*guidelines\]'; then | ||
echo "Contributing guidelines acknowledged." | ||
print_success | ||
exit 0 | ||
else | ||
echo "Contributing guidelines not acknowledged." | ||
|
||
# Post a comment on the PR: | ||
comment="Hello! Thank you for your contribution to stdlib. | ||
We noticed that the contributing guidelines acknowledgment is missing from your pull request. Here's what you need to do: | ||
1. Please read our [contributing guidelines][contributing]. | ||
2. Update your pull request description to include this checked box: | ||
\`- [x] Read, understood, and followed the [contributing guidelines](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md)\` | ||
This acknowledgment confirms that you've read the guidelines, which include: | ||
- The developer's certificate of origin | ||
- Your agreement to license your contributions under the project's terms | ||
We can't review or accept contributions without this acknowledgment. | ||
Thank you for your understanding and cooperation. We look forward to reviewing your contribution!" | ||
|
||
if ! curl -s -X POST \ | ||
-H "Authorization: token ${GITHUB_TOKEN}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${pr_number}/comments" \ | ||
-d "{\"body\":$(echo "$comment" | jq -R -s -c .)}"; then | ||
echo "Failed to post comment on PR." | ||
on_error 1 | ||
fi | ||
|
||
exit 1 | ||
fi | ||
} | ||
|
||
# Set an error handler to print captured output and perform any clean-up tasks: | ||
trap 'on_error' ERR | ||
|
||
# Run main: | ||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.