Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add verify code styles workflow. #10450

Merged
merged 3 commits into from
Dec 14, 2024

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Dec 9, 2024

This PR add lint workflow to verify code styles.
By executing dotnet format --verify-no-changes command.

If diffs are found.
lint.ymlworkflow add following sticky comment to PR.

## Failed to run the `lint.yml` workflow
To fix workflow errors. Please follow the steps below.
 1. Run `dotnet format` command.
 2. Commit changes as separated commit.
 3. Push changes to source branch of PR.

@filzrev
Copy link
Contributor Author

filzrev commented Dec 9, 2024

Workflow failed with following error.

marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 is not allowed to be used in dotnet/docfx.
Actions in this workflow must be: within a repository that belongs to your Enterprise account, created by GitHub, verified in the GitHub Marketplace,
or matching the following: 

codecov/codecov-action@*,
peaceiris/actions-gh-pages@*, 
azure/pipelines@*, 
khan/pull-request-comment-trigger@*, 
stefanzweifel/git-auto-commit-action@*, 
paulhatch/semantic-version@*, 
dorny/test-reporter@*.

@yufeih
Is it able to add marocchino/sticky-pull-request-comment@* to allowed list?
I thought security risk is relatively low because action is referenced with pinned commit hash.

Alternative solution is to using gh pr comment command.
But it's hard to implement sticky-pull-request-comment like features.

@yufeih
Copy link
Contributor

yufeih commented Dec 10, 2024

@filzrev marocchino/sticky-pull-request-comment@* added to allow list

@filzrev filzrev force-pushed the chore-add-lint-check-workflow branch from 9f8ea2c to e3fc023 Compare December 10, 2024 10:19
@filzrev
Copy link
Contributor Author

filzrev commented Dec 10, 2024

Following error is thrown when running lint workflow.

Error: Resource not accessible by integration

It seems it can's get permission to write comment when using pull_request trigger
And PR is created from forked repository.
(It need to use pull_request_target trigger instead. but it's not desirable for security reasons)

I need to switch alternative solution instead of sticky-pull-request-comment approach.

@filzrev filzrev force-pushed the chore-add-lint-check-workflow branch from e3fc023 to 7ad6450 Compare December 10, 2024 10:46
@filzrev
Copy link
Contributor Author

filzrev commented Dec 10, 2024

Add commit (f5ef9ab)
to suppress dotnet format --verify-no-changes error that occurred when running on CI (Ubuntu environment).

It seems relating to following issue.

  • https://github.com/dotnet/format/issues/1566

@yufeih yufeih merged commit 233ffb8 into dotnet:main Dec 14, 2024
8 checks passed
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