Skip to content

[Lint] Add bat version and lint CI permission - #132

Merged
Ti-Tai Wang (titaiwangms) merged 6 commits into
microsoft:mainfrom
titaiwangms:titaiwang/wrapup_lint
Sep 28, 2022
Merged

Ti-Tai Wang (titaiwangms) merged 6 commits into
microsoft:mainfrom
titaiwangms:titaiwang/wrapup_lint

Conversation

@titaiwangms

@titaiwangms Ti-Tai Wang (titaiwangms) commented Sep 26, 2022 •

Copy link
Copy Markdown
Contributor
  1. Add bat version linter for Windows user
  2. Add permission setting for third-party actions in lint.yaml to limit their access
  3. Did some research and discussed with Justin Chu (@justinchuby), CodeQL only hints on the modified file in a PR, and the error/warning/note are all informative, and aligned with pylint/mypy which are included in out lint, so I suggest we can have it for a while, and see how it goes. (However, disable one or few rules that we don't need in CodeQL seems doable in the next release: How to disable particular rule by its ID from GitHub workflow? github/codeql#7937)

fixes #127

Comment thread .github/workflows/lint.yaml Outdated
lint-python:
name: Lint Python
runs-on: ubuntu-latest
permissions:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I referenced from Pytorch/TensorRT setting, which is also using third-party actions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think only lint-python will need to set permissions because others don't use 3p actions.

Comment thread .github/workflows/lint.yaml Outdated
Comment thread .github/workflows/lint.yaml Outdated
Comment on lines +51 to +63
permissions:
actions: write
checks: write
contents: write
deployments: none
id-token: write
issues: write
discussions: write
packages: write
pull-requests: write
repository-projects: none
security-events: none
statuses: write

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
permissions:
actions: write
checks: write
contents: write
deployments: none
id-token: write
issues: write
discussions: write
packages: write
pull-requests: write
repository-projects: none
security-events: none
statuses: write

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Do we need to change those not using third-party as well?

@justinchuby Justin Chu (justinchuby) Sep 27, 2022 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

these jobs are fine. as long as they are not 3p github actions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Then this one if good to go?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would just remove the whole permissions section for these two jobs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That won't work. It seems if you have one with specify permissions, you will have to define others as well, based on my trial.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm that's good to know. kinda surprising that it works this way though

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nah, I just checked my commit. I think I haven't tried that. Let me give it a try.

Comment thread .github/workflows/lint.yaml Outdated
id-token: write
issues: none
discussions: none
packages: none

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

none fields can be removed because "If you specify the access for any of these scopes, all of those that are not specified are set to none." https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think one of the benefits of leaving it there is that the next person, who needs to change the permission, can see what options he/she has on this (No need to investigate again). Besides, we are not adding more lines on this. What do you think?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sounds good to me

@titaiwangms

Copy link
Copy Markdown
Contributor Author

cc G. Ramalingam (@gramalingam) for batch files review.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, thanks!

@titaiwangms
Ti-Tai Wang (titaiwangms) merged commit 05778ce into microsoft:main Sep 28, 2022
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.

[Lint] Wrap-up lint adding

3 participants