Skip to content

Migrate action from JavaScript to TypeScript#32

Open
malmstein wants to merge 5 commits into
mainfrom
david/typescript_migration
Open

Migrate action from JavaScript to TypeScript#32
malmstein wants to merge 5 commits into
mainfrom
david/typescript_migration

Conversation

@malmstein
Copy link
Copy Markdown
Collaborator

@malmstein malmstein commented Mar 4, 2026

Replaces the JS implementation with the TypeScript version, which includes expanded functionality, improved test coverage, and updated tooling.

Forked from https://github.com/actions/typescript-action

Look at https://github.com/duckduckgo/native-github-asana-sync/blob/9a36ff32081a3d7282c9b002d53fd59c22dbc220/README.md for the whole list of options


Note

High Risk
Replaces the action’s implementation and runtime (now node24) and adds/changes behavior for PR-driven Asana updates (pr-asana-sync), which can affect real Asana tasks and workflow compatibility. Risk is mitigated somewhat by substantial new unit/local-action tests and CI checks, but behavior/regressions should be validated end-to-end.

Overview
Migrates the action from a single action.js implementation to a TypeScript codebase (src/ compiled to dist/), updating action.yml with a clearer input set, expanded outputs (including PR-sync result/task-url and asanaUserId), and switching the runtime to node24.

Adds a new pr-asana-sync action that creates/updates an Asana approval task for PR events (including reviewer/assignee handling, optional randomized reviewer assignment via GitHub API, status/approval syncing, optional auto-close, and section moves). Also introduces extensive Jest coverage plus @github/local-action smoke/integration-style tests and fixtures.

Modernizes repo tooling and governance: new CI workflows (ci, check-dist, codeql, linter), Dependabot config, Licensed config + cached license files, devcontainer/VSCode configs, updated formatting/lint configs, CODEOWNERS, and a significantly simplified/updated README.

Written by Cursor Bugbot for commit 70c357d. This will update automatically on new commits. Configure here.

Replaces the JS implementation with the TypeScript version, which includes
expanded functionality, improved test coverage, and updated tooling.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@malmstein
Copy link
Copy Markdown
Collaborator Author

@nshuba I've know we’ve talked about this in the past and wanted to get the ball rolling.

@github-advanced-security
Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: CI test-action job uses template inputs, will always fail
    • Removed the template boilerplate test-action job from ci.yml that passed milliseconds: 2000 instead of the required action input, which would always cause core.getInput('action', { required: true }) to throw.
  • ✅ Fixed: Unused wait.ts module is template dead code
    • Deleted src/wait.ts, __fixtures__/wait.ts, and __tests__/wait.test.ts which were template leftover dead code never imported by the actual action.

Create PR

Or push these changes by commenting:

@cursor push 5b4031c95f
Preview (5b4031c95f)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -43,22 +43,3 @@
       - name: Test
         id: npm-ci-test
         run: npm run ci-test
-
-  test-action:
-    name: GitHub Actions Test
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Checkout
-        id: checkout
-        uses: actions/checkout@v6
-
-      - name: Test Local Action
-        id: test-action
-        uses: ./
-        with:
-          milliseconds: 2000
-
-      - name: Print Output
-        id: output
-        run: echo "${{ steps.test-action.outputs.time }}"

diff --git a/__fixtures__/wait.ts b/__fixtures__/wait.ts
deleted file mode 100644
--- a/__fixtures__/wait.ts
+++ /dev/null
@@ -1,3 +1,0 @@
-import { jest } from '@jest/globals'
-
-export const wait = jest.fn<typeof import('../src/wait.js').wait>()
\ No newline at end of file

diff --git a/__tests__/wait.test.ts b/__tests__/wait.test.ts
deleted file mode 100644
--- a/__tests__/wait.test.ts
+++ /dev/null
@@ -1,24 +1,0 @@
-/**
- * Unit tests for src/wait.ts
- */
-import { wait } from '../src/wait.js'
-
-describe('wait.ts', () => {
-  it('Throws an invalid number', async () => {
-    const input = parseInt('foo', 10)
-
-    expect(isNaN(input)).toBe(true)
-
-    await expect(wait(input)).rejects.toThrow('milliseconds is not a number')
-  })
-
-  it('Waits with a valid number', async () => {
-    const start = new Date()
-    await wait(500)
-    const end = new Date()
-
-    const delta = Math.abs(end.getTime() - start.getTime())
-
-    expect(delta).toBeGreaterThan(450)
-  })
-})
\ No newline at end of file

diff --git a/src/wait.ts b/src/wait.ts
deleted file mode 100644
--- a/src/wait.ts
+++ /dev/null
@@ -1,13 +1,0 @@
-/**
- * Waits for a number of milliseconds.
- *
- * @param milliseconds The number of milliseconds to wait.
- * @returns Resolves with 'done!' after the wait is over.
- */
-export async function wait(milliseconds: number): Promise<string> {
-  return new Promise((resolve) => {
-    if (isNaN(milliseconds)) throw new Error('milliseconds is not a number')
-
-    setTimeout(() => resolve('done!'), milliseconds)
-  })
-}
\ No newline at end of file

Comment thread .github/workflows/ci.yml Outdated
Comment thread __fixtures__/wait.ts
@@ -0,0 +1,3 @@
import { jest } from '@jest/globals'

export const wait = jest.fn<typeof import('../src/wait.js').wait>()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused wait.ts module is template dead code

Low Severity

src/wait.ts is never imported by src/main.ts or src/index.ts — it's leftover from the actions/typescript-action template. Its fixture and test file (__fixtures__/wait.ts, __tests__/wait.test.ts) also only exercise this dead code. Keeping it adds maintenance overhead and may confuse contributors.


Please tell me if this was useful or not with a 👍 or 👎.

Additional Locations (1)

Fix in Cursor Fix in Web

malmstein and others added 3 commits March 4, 2026 14:35
- Remove the leftover GitHub Actions template test job that used
  a `milliseconds` input not present in this action
- Fix Prettier formatting in 3 markdown files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ci.yml: fix Prettier formatting after test job removal
- .markdown-lint.yml: disable MD013 for code blocks (long bash commands)
- release-notes-v1.0.{0,1,2}.md: fix MD041 (h2->h1) and MD029 (list prefixes)
- release-notes-v1.0.0.md: fix NATURAL_LANGUAGE "pre-release" -> "prerelease"
- release-notes-v1.0.2.md: fix NATURAL_LANGUAGE "README" -> "readme"
- plans/major_release_runbook: fix NATURAL_LANGUAGE "repo" -> "repository"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Nested undici 5.29.0 entries from @actions/github and @github/local-action
triggered CVE-2026-22036. Added an overrides entry to pin all undici
instances to >=6.23.0 and regenerated the lockfile.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Regenerate bundle to reflect undici override (5.29.0 -> 6.23.0).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants