fix: handle missing properties, error types, and stack in @stdlib/error/reviver #6724
Workflow file for this run
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
#/ | ||
# @license Apache-2.0 | ||
# | ||
# Copyright (c) 2025 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: label_commands | ||
# Workflow triggers: | ||
on: | ||
pull_request_target: | ||
types: | ||
- labeled | ||
- unlabeled | ||
- opened | ||
- synchronize | ||
# Workflow jobs: | ||
jobs: | ||
# Define a job for removing the label and adding in-progress label: | ||
manage_labels: | ||
# Define a display name: | ||
name: 'Manage labels' | ||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
# Define the job's steps: | ||
steps: | ||
- name: 'Remove label' | ||
# Pin action to full length commit SHA | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
github-token: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }} | ||
script: | | ||
const labels = ['bot: Merge', 'bot: Rebase', 'bot: Check Files', 'bot: Lint Autofix', 'bot: Update Copyright Years']; | ||
const hasLabel = labels.includes('${{ github.event.label.name }}'); | ||
if (hasLabel) { | ||
try { | ||
await github.rest.issues.removeLabel({ | ||
'owner': context.repo.owner, | ||
'repo': context.repo.repo, | ||
'issue_number': context.issue.number, | ||
'name': '${{ github.event.label.name }}' | ||
}); | ||
} catch (error) { | ||
console.log('Error removing label: %s', error.message); | ||
} | ||
} else { | ||
console.log("Manage labels check passed."); | ||
} | ||
- name: 'Add in-progress label' | ||
if: contains(fromJSON('["bot: Merge", "bot: Rebase", "bot: Check Files", "bot: Lint Autofix", "bot: Update Copyright Years"]'), github.event.label.name) | ||
# Pin action to full length commit SHA | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
github-token: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }} | ||
script: | | ||
github.rest.issues.addLabels({ | ||
'owner': context.repo.owner, | ||
'repo': context.repo.repo, | ||
'issue_number': context.issue.number, | ||
'labels': ['bot: In Progress'] | ||
}) | ||
# Add initial reaction to comment with slash command: | ||
- name: 'Add initial reaction' | ||
if: contains(fromJSON('["bot: Merge", "bot: Rebase", "bot: Check Files", "bot: Lint Autofix", "bot: Update Copyright Years"]'), github.event.label.name) | ||
run: | | ||
curl -X POST \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: Bearer ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }}" \ | ||
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/reactions" \ | ||
-d '{"content":"eyes"}' | ||
# Define a job for checking for required files: | ||
check_files: | ||
# Define a display name: | ||
name: 'Check for required files' | ||
# Ensure initial reaction job has completed before running this job: | ||
needs: [ manage_labels ] | ||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
# Run reusable workflow or mark as successful: | ||
steps: | ||
- name: 'Run check for required files or mark as successful' | ||
run: | | ||
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'bot: Check Files') }}" == "true" ]]; then | ||
echo "Running check for required files..." | ||
# Placeholder for reusable workflow execution | ||
exit 0 | ||
else | ||
echo "Check for required files passed." | ||
fi | ||
# Define a job for updating copyright header years: | ||
update_copyright_years: | ||
# Define a display name: | ||
name: 'Update copyright header years' | ||
# Ensure initial reaction job has completed before running this job: | ||
needs: [ manage_labels ] | ||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
# Run reusable workflow or mark as successful: | ||
steps: | ||
- name: 'Run update copyright header years or mark as successful' | ||
run: | | ||
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'bot: Update Copyright Years') }}" == "true" ]]; then | ||
echo "Running update copyright header years..." | ||
# Placeholder for reusable workflow execution | ||
exit 0 | ||
else | ||
echo "Update copyright header years check passed." | ||
fi | ||
# Define a job for auto-fixing lint errors: | ||
fix_lint_errors: | ||
# Define a display name: | ||
name: 'Auto-fix lint errors' | ||
# Ensure initial reaction job has completed before running this job: | ||
needs: [ manage_labels ] | ||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
# Run reusable workflow or mark as successful: | ||
steps: | ||
- name: 'Run auto-fix lint errors or mark as successful' | ||
run: | | ||
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'bot: Lint Autofix') }}" == "true" ]]; then | ||
echo "Running auto-fix lint errors..." | ||
# Placeholder for reusable workflow execution | ||
exit 0 | ||
else | ||
echo "Auto-fix lint errors check passed." | ||
fi | ||
# Define a job for merging develop branch: | ||
merge_develop: | ||
# Define a display name: | ||
name: 'Merge changes from develop branch into this PR' | ||
# Ensure initial reaction job has completed before running this job: | ||
needs: [ manage_labels ] | ||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
# Run reusable workflow or mark as successful: | ||
steps: | ||
- name: 'Run merge develop or mark as successful' | ||
run: | | ||
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'bot: Merge') }}" == "true" ]]; then | ||
echo "Running merge changes from develop branch..." | ||
# Placeholder for reusable workflow execution | ||
exit 0 | ||
else | ||
echo "Merge changes from develop branch passed." | ||
fi | ||
# Define a job for rebasing on develop branch: | ||
rebase_develop: | ||
# Define a display name: | ||
name: 'Rebase this PR on top of develop branch' | ||
# Ensure initial reaction job has completed before running this job: | ||
needs: [ manage_labels ] | ||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
# Run reusable workflow or mark as successful: | ||
steps: | ||
- name: 'Run rebase develop or mark as successful' | ||
run: | | ||
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'bot: Rebase') }}" == "true" ]]; then | ||
echo "Running rebase on top of develop branch..." | ||
# Placeholder for reusable workflow execution | ||
exit 0 | ||
else | ||
echo "Rebase on top of develop branch passed." | ||
fi | ||
# Define a job for removing the in-progress label: | ||
remove_progress_label: | ||
# Define a display name: | ||
name: 'Remove in-progress label' | ||
# Define the type of virtual host machine: | ||
runs-on: ubuntu-latest | ||
# Ensure all previous jobs have completed before running this job: | ||
needs: [ manage_labels, check_files, update_copyright_years, fix_lint_errors, merge_develop, rebase_develop ] | ||
# Define the job's steps: | ||
steps: | ||
- name: 'Remove in-progress label' | ||
# Run the step regardless of the outcome of previous steps: | ||
if: always() | ||
# Pin action to full length commit SHA | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
github-token: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }} | ||
script: | | ||
const labels = ['bot: Merge', 'bot: Rebase', 'bot: Check Files', 'bot: Lint Autofix', 'bot: Update Copyright Years']; | ||
const hasLabel = labels.some(label => context.payload.pull_request.labels.some(l => l.name === label)); | ||
if (hasLabel) { | ||
try { | ||
await github.rest.issues.removeLabel({ | ||
'owner': context.repo.owner, | ||
'repo': context.repo.repo, | ||
'issue_number': context.issue.number, | ||
'name': 'bot: In Progress' | ||
}); | ||
} catch (error) { | ||
console.log('Error removing label: %s', error.message); | ||
} | ||
} else { | ||
console.log("Remove in-progress label check passed."); | ||
} |