-
-
Notifications
You must be signed in to change notification settings - Fork 907
build: refactor workflow to create multiple declarations PRs #6080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -83,11 +83,6 @@ jobs: | |
make install-node-modules || make install-node-modules || make install-node-modules | ||
timeout-minutes: 15 | ||
|
||
# Update namespace Typescript declarations: | ||
- name: 'Update declarations' | ||
run: | | ||
make list-pkgs-namespaces | node lib/node_modules/@stdlib/_tools/scripts/create_namespace_types.js | ||
|
||
# Disable Git hooks: | ||
- name: 'Disable Git hooks' | ||
run: | | ||
|
@@ -103,44 +98,56 @@ jobs: | |
git_user_signingkey: true | ||
git_commit_gpgsign: true | ||
|
||
# Create a pull request with the updated declarations: | ||
- name: 'Create pull request' | ||
id: cpr | ||
# Pin action to full length commit SHA | ||
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | ||
with: | ||
title: 'feat: update namespace TypeScript declarations' | ||
body: | | ||
This PR | ||
|
||
- updates namespace TypeScript declarations | ||
|
||
## Reviewer Checklist | ||
|
||
- [ ] **Check the scope of the changes** (following [Conventional Commits](https://www.conventionalcommits.org)): | ||
- Are these **new APIs**? Then this is a `feat`. | ||
- Are these **changes to existing APIs** that could break compatibility? Then this is a `feat!` (i.e., a breaking change). | ||
- Are these **only documentation** changes to existing APIs? Then this is `docs`. | ||
- [ ] Update the PR title to align with the change type (`feat`, `feat!`, or `docs`). | ||
- [ ] Approve the PR once you are confident about the classification and changes made. | ||
|
||
commit-message: 'feat: update namespace TypeScript declarations' | ||
committer: 'stdlib-bot <[email protected]>' | ||
signoff: true | ||
token: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }} | ||
labels: | | ||
documentation | ||
automated-pr | ||
team-reviewers: | | ||
reviewers | ||
branch: update-namespace-declarations | ||
delete-branch: true | ||
|
||
# Create Markdown summary of the pull request: | ||
- name: 'Create summary' | ||
# Update namespace Typescript declarations and create PRs: | ||
- name: 'Update declarations and create PRs' | ||
run: | | ||
echo "# :tada: Pull Request created! :tada:" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "Pull request ${{ steps.cpr.outputs.pull-request-number }} was successfully ${{ steps.cpr.outputs.pull-request-operation }}." | ||
echo ":link: [${{ steps.cpr.outputs.pull-request-url }}](${{ steps.cpr.outputs.pull-request-url }})." >> $GITHUB_STEP_SUMMARY | ||
echo "Head SHA: [${{ steps.cpr.outputs.pull-request-head-sha }}](${{ steps.cpr.outputs.pull-request-url }}/commits/${{ steps.cpr.outputs.pull-request-head-sha }})." >> $GITHUB_STEP_SUMMARY | ||
# Create a temporary file to store the list of namespaces: | ||
make list-pkgs-namespaces > namespaces.txt | ||
|
||
# Process each namespace: | ||
while IFS= read -r namespace; do | ||
if [ -n "$namespace" ] && [[ $namespace != *"_tools"* ]]; then | ||
branch_name="update-$(echo "$namespace" | sed 's/@stdlib\///' | sed 's/\//-/g')-declarations" | ||
git checkout -b "$branch_name" | ||
|
||
# Generate declarations for this namespace | ||
echo "$namespace" | node lib/node_modules/@stdlib/_tools/scripts/create_namespace_types.js | ||
|
||
# Check if there are changes: | ||
if ! git diff --quiet -- lib/node_modules/@stdlib; then | ||
# Stage only changes in the stdlib directory: | ||
git add lib/node_modules/@stdlib | ||
|
||
# Commit changes: | ||
git commit -m "feat: update \`${namespace}\` TypeScript declarations" --signoff | ||
|
||
# Push branch and create PR | ||
kgryte marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
git push origin "$branch_name" | ||
|
||
gh pr create \ | ||
--title "feat: update \`${namespace}\` TypeScript declarations" \ | ||
--body "This PR updates TypeScript declarations for the \`${namespace}\` namespace. | ||
|
||
## Reviewer Checklist | ||
|
||
- [ ] **Check the scope of the changes** (following [Conventional Commits](https://www.conventionalcommits.org)): | ||
- Are these **new APIs**? Then this is a \`feat\`. | ||
- Are these **changes to existing APIs** that could break compatibility? Then this is a \`feat!\` (i.e., a breaking change). | ||
- Are these **only documentation** changes to existing APIs? Then this is \`docs\`. | ||
- [ ] Update the PR title to align with the change type (\`feat\`, \`feat!\`, or \`docs\`). | ||
- [ ] Approve the PR once you are confident about the classification and changes made." \ | ||
--label "Documentation" \ | ||
--label "automated-pr" \ | ||
--reviewer "reviewers" \ | ||
--base develop \ | ||
--head "$branch_name" | ||
fi | ||
|
||
git checkout develop | ||
fi | ||
done < namespaces.txt | ||
|
||
# Clean up temporary file: | ||
rm namespaces.txt | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.