Skip to content

draft#349

Draft
salmanmkc wants to merge 1 commit intomainfrom
salmanmkc/workflows-permission
Draft

draft#349
salmanmkc wants to merge 1 commit intomainfrom
salmanmkc/workflows-permission

Conversation

@salmanmkc
Copy link
Copy Markdown
Contributor

@salmanmkc salmanmkc commented Apr 10, 2026

Add 'workflows' as a valid permission scope in the permissions-mapping
schema. The workflows permission supports only 'write' (or none),
matching the GitHub App permissions model where workflows: write
allows updating GitHub Actions workflow files.

This enables autocomplete and validation for 'permissions: workflows:'
in workflow YAML files.
Copilot AI review requested due to automatic review settings April 10, 2026 22:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds the workflows permission scope to the workflow schema so the language service can autocomplete and validate permissions: workflows: write in GitHub Actions workflow YAML.

Changes:

  • Extend permissions-mapping in the workflow schema to include workflows with permission-level-write-or-no-access.
  • Add completion tests ensuring workflows is suggested at both top-level and job-level permissions.
  • Add completion test coverage ensuring workflows values do not include read.
Show a summary per file
File Description
workflow-parser/src/workflow-v1.0.json Adds workflows to the permissions mapping schema using permission-level-write-or-no-access.
languageservice/src/complete.test.ts Adds completion tests verifying workflows appears in permissions key completion and that value completion doesn’t offer read.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

expect(result).not.toBeUndefined();
const labels = result.map(x => x.label);
expect(labels).toContain("write");
expect(labels).not.toContain("read");
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The test name says it "offers only write and none" for workflows, but the assertions only check for write and absence of read. Add an assertion that none is offered (and consider asserting no other values are present) so the test matches its intent and guards the permission-level-write-or-no-access behavior.

Suggested change
expect(labels).not.toContain("read");
expect(labels).toContain("none");
expect([...labels].sort()).toEqual(["none", "write"]);

Copilot uses AI. Check for mistakes.
Comment on lines +1019 to +1056
describe("permissions workflows completion", () => {
it("includes workflows in top-level permissions", async () => {
const input = `on: push
permissions:
|`;
const result = await complete(...getPositionFromCursor(input));

expect(result).not.toBeUndefined();
const labels = result.map(x => x.label);
expect(labels).toContain("workflows");
});

it("offers only write and none for workflows", async () => {
const input = `on: push
permissions:
workflows: |`;
const result = await complete(...getPositionFromCursor(input));

expect(result).not.toBeUndefined();
const labels = result.map(x => x.label);
expect(labels).toContain("write");
expect(labels).not.toContain("read");
});

it("includes workflows in job-level permissions", async () => {
const input = `on: push
jobs:
build:
runs-on: ubuntu-latest
permissions:
|`;
const result = await complete(...getPositionFromCursor(input));

expect(result).not.toBeUndefined();
const labels = result.map(x => x.label);
expect(labels).toContain("workflows");
});
});
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

This PR states it enables both autocomplete and validation for permissions: workflows: write, but the added tests only cover completion. Consider adding a validation test that workflows: write is accepted and workflows: read is rejected to ensure the schema change is exercised through the validation pipeline too.

Copilot uses AI. Check for mistakes.
@salmanmkc salmanmkc changed the title Add workflows permission scope to schema draft Apr 10, 2026
@salmanmkc salmanmkc marked this pull request as draft April 10, 2026 22:38
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.

2 participants