From 128187a740ad3d57b572ccbf34426efa5aaef385 Mon Sep 17 00:00:00 2001 From: JounQin Date: Tue, 10 Nov 2026 05:46:49 +0000 Subject: [PATCH] Revert "feat: add workflow write actions (#130)" This reverts commit b666c6fc9cb2bfa081124cabe4c0e079718c3a6e. --- .changeset/workflow-actions.md | 5 ---- README.md | 3 --- packages/core/src/actions.ts | 39 ---------------------------- test/unit/actions.test.ts | 47 ---------------------------------- 4 files changed, 94 deletions(-) delete mode 100644 .changeset/workflow-actions.md diff --git a/.changeset/workflow-actions.md b/.changeset/workflow-actions.md deleted file mode 100644 index c5923f7a..00000000 --- a/.changeset/workflow-actions.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"gcb-core": minor ---- - -Add the workflow write actions: `workflow:run` (`gh workflow run `, with `--ref` and repeatable `--raw-field`), `workflow:enable` and `workflow:disable`. diff --git a/README.md b/README.md index f4ff149b..ba4e7ab2 100644 --- a/README.md +++ b/README.md @@ -825,9 +825,6 @@ actions. Grant them on the App, then approve any changed permissions on each ins | `run rerun` | `actions: write` | | `release list` | `contents: read` | | `release view` | `contents: read` | -| `workflow run` | `actions: write`, `contents: read` | -| `workflow enable` | `actions: write` | -| `workflow disable` | `actions: write` | | `workflow list` | `actions: read` | | `workflow view` | `actions: read`, `contents: read` | | `label list` | `issues: read` | diff --git a/packages/core/src/actions.ts b/packages/core/src/actions.ts index a8564d09..b4dcb997 100644 --- a/packages/core/src/actions.ts +++ b/packages/core/src/actions.ts @@ -686,42 +686,6 @@ const RELEASE_VIEW: GhAction = { appUser: true, } -// GitHub: POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches -const WORKFLOW_RUN: GhAction = { - name: 'workflow:run', - command: ['workflow', 'run'], - positionals: [{ name: 'workflow', type: 'string', required: true }], - flags: [ - { name: 'ref', type: 'string' }, - { name: 'raw-field', type: 'string', repeatable: true }, - ], - permissions: { actions: 'write', contents: 'read' }, - timeoutSeconds: 120, - appUser: true, -} - -// GitHub: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable -const WORKFLOW_ENABLE: GhAction = { - name: 'workflow:enable', - command: ['workflow', 'enable'], - positionals: [{ name: 'workflow', type: 'string', required: true }], - flags: [], - permissions: { actions: 'write' }, - timeoutSeconds: 60, - appUser: true, -} - -// GitHub: PUT /repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable -const WORKFLOW_DISABLE: GhAction = { - name: 'workflow:disable', - command: ['workflow', 'disable'], - positionals: [{ name: 'workflow', type: 'string', required: true }], - flags: [], - permissions: { actions: 'write' }, - timeoutSeconds: 60, - appUser: true, -} - // GitHub: GET /repos/{owner}/{repo}/actions/workflows const WORKFLOW_LIST: GhAction = { name: 'workflow:list', @@ -909,9 +873,6 @@ export const GH_ACTIONS: Readonly> = Object.freeze({ 'run:rerun': RUN_RERUN, 'release:list': RELEASE_LIST, 'release:view': RELEASE_VIEW, - 'workflow:run': WORKFLOW_RUN, - 'workflow:enable': WORKFLOW_ENABLE, - 'workflow:disable': WORKFLOW_DISABLE, 'workflow:list': WORKFLOW_LIST, 'workflow:view': WORKFLOW_VIEW, 'label:list': LABEL_LIST, diff --git a/test/unit/actions.test.ts b/test/unit/actions.test.ts index e95e533f..2d5cef23 100644 --- a/test/unit/actions.test.ts +++ b/test/unit/actions.test.ts @@ -52,9 +52,6 @@ describe('gh action catalog', () => { 'run:rerun', 'release:list', 'release:view', - 'workflow:run', - 'workflow:enable', - 'workflow:disable', 'workflow:list', 'workflow:view', 'label:list', @@ -117,12 +114,6 @@ describe('gh action catalog', () => { assert.equal(getGhAction('issue:comment-edit').appUser, true) assert.deepEqual(getGhAction('release:list').permissions, { contents: 'read' }) assert.deepEqual(getGhAction('release:view').permissions, { contents: 'read' }) - assert.deepEqual(getGhAction('workflow:run').permissions, { - actions: 'write', - contents: 'read', - }) - assert.deepEqual(getGhAction('workflow:enable').permissions, { actions: 'write' }) - assert.deepEqual(getGhAction('workflow:disable').permissions, { actions: 'write' }) assert.deepEqual(getGhAction('workflow:list').permissions, { actions: 'read' }) assert.deepEqual(getGhAction('workflow:view').permissions, { actions: 'read', @@ -394,44 +385,6 @@ describe('buildGhArgv', () => { const injected = buildGhArgv('release:view', { tag: '--web' }, 'acme/widget') assert.deepEqual(injected.slice(-2), ['--', '--web']) assert.throws(() => buildGhArgv('workflow:view', {}, 'acme/widget'), /needs workflow/u) - assert.deepEqual( - buildGhArgv( - 'workflow:run', - { workflow: 'ci.yml', ref: 'main', 'raw-field': ['a=1', 'b=@file'] }, - 'acme/widget', - ), - [ - 'workflow', - 'run', - '--ref', - 'main', - '--raw-field', - 'a=1', - '--raw-field', - 'b=@file', - '--repo', - 'acme/widget', - '--', - 'ci.yml', - ], - ) - assert.deepEqual(buildGhArgv('workflow:enable', { workflow: 'ci.yml' }, 'acme/widget'), [ - 'workflow', - 'enable', - '--repo', - 'acme/widget', - '--', - 'ci.yml', - ]) - assert.deepEqual(buildGhArgv('workflow:disable', { workflow: 'ci.yml' }, 'acme/widget'), [ - 'workflow', - 'disable', - '--repo', - 'acme/widget', - '--', - 'ci.yml', - ]) - assert.throws(() => buildGhArgv('workflow:run', {}, 'acme/widget'), /needs workflow/u) assert.throws( () => buildGhArgv('workflow:view', { workflow: 'ci.yml', ref: 'main' }, 'acme/widget'), /needs --yaml with --ref/u,