Skip to content

Commit 439cffa

Browse files
committed
build: create sub-issues for TypeScript declaration lint errors
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent dcf7676 commit 439cffa

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

.github/workflows/lint_random_files.yml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,13 +502,58 @@ jobs:
502502
503503
# Lint TypeScript declarations files:
504504
- name: 'Lint TypeScript declarations files'
505+
id: lint-typescript-declarations
505506
if: ( github.event.inputs.javascript != 'false' ) && ( success() || failure() )
506507
run: |
508+
set -o pipefail
507509
files=$(echo "${{ steps.random-files.outputs.files }}" | tr ',' '\n' | grep -E '\.d\.ts$' | tr '\n' ' ')
508510
if [[ -n "${files}" ]]; then
509-
make TYPESCRIPT_DECLARATIONS_LINTER=eslint lint-typescript-declarations-files FAST_FAIL=0 FILES="${files}"
511+
make TYPESCRIPT_DECLARATIONS_LINTER=eslint lint-typescript-declarations-files FAST_FAIL=0 FILES="${files}" 2>&1 | tee lint_typescript_declarations_errors.txt
510512
fi
511513
514+
# Create sub-issue for TypeScript declarations lint failures:
515+
- name: 'Create sub-issue for TypeScript declarations lint failures'
516+
if: failure() && contains(steps.lint-typescript-declarations.outcome, 'failure')
517+
env:
518+
GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }}
519+
run: |
520+
strip_ansi() {
521+
sed -r 's/\x1B\[[0-9;]*[mK]//g'
522+
}
523+
524+
BODY_FILE="$GITHUB_WORKSPACE/lint_issue_body.md"
525+
cat << EOF > "$BODY_FILE"
526+
## TypeScript Declarations Linting Failures
527+
528+
Linting failures were detected in the automated TypeScript declarations lint workflow run.
529+
530+
### Workflow Details
531+
532+
- Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
533+
- Type: TypeScript Declarations Linting
534+
- Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
535+
536+
### Error Details
537+
538+
\`\`\`
539+
$(cat lint_typescript_declarations_errors.txt | strip_ansi)
540+
\`\`\`
541+
542+
### Pull Request Instructions
543+
544+
- Please use the following PR title format:
545+
"chore: fix TypeScript declarations lint errors (issue #<ISSUE_NUMBER>)".
546+
- Reference this issue in the "Related Issues" section of the PR body as "resolves #<ISSUE_NUMBER>".
547+
EOF
548+
549+
. "$GITHUB_WORKSPACE/.github/workflows/scripts/create_sub_issue" \
550+
'Fix TypeScript declarations lint errors' \
551+
"$BODY_FILE" \
552+
"9110" \
553+
"Good First Issue"
554+
555+
rm "$BODY_FILE"
556+
512557
# Lint license headers:
513558
- name: 'Lint license headers'
514559
if: success() || failure()

0 commit comments

Comments
 (0)