support repositories override - #73
Conversation
24b3b1b to
68d6af8
Compare
There was a problem hiding this comment.
I'm not sure if "zizmor-policy" is a good name.
For example, I think zizmor-config is confusing, because this now is a custom config we have.
An alternative solution would be keep zizmor-default.yml and put the overrides in a different files.
There was a problem hiding this comment.
zizmor-policy sounds good to me. Wouldn't splitting it mean the workflow and CLI have to merge two files?
| archived-uses: | ||
| disable: false |
There was a problem hiding this comment.
it was disabled before 😎
68d6af8 to
9440865
Compare
| rust-lang/chalk: | ||
| rules: | ||
| archived-uses: | ||
| disable: true |
There was a problem hiding this comment.
see rust-lang/chalk#834. It doesn't make sense to work on that PR because that repo is unused at the moment
There was a problem hiding this comment.
It totally makes sense. Should I go ahead and close rust-lang/chalk#834 then? Chalk also has the adhoc-packages finding in publish.yml, so I guess the same applies there. I can add it to this override when I open the PR for #48.
There was a problem hiding this comment.
Great to know this approach resonates with you! Yes I think you can close that PR 👍
c511426 to
77a7f9c
Compare
ubiratansoares
left a comment
There was a problem hiding this comment.
Added a few comments
| fn effective_config(&self, repository: &str) -> anyhow::Result<String> { | ||
| yq(&[BUILD_CONFIG_EXPR], self.file.path(), repository) | ||
| } | ||
|
|
||
| /// Write `repository`'s zizmor configuration to a temporary file that is | ||
| /// deleted on drop. | ||
| /// | ||
| /// `repository` is GitHub's canonical `owner/name`; override lookup is | ||
| /// case-sensitive. | ||
| pub(crate) fn write_config(&self, repository: &str) -> anyhow::Result<NamedTempFile> { | ||
| temp_file(&self.effective_config(repository)?) | ||
| } |
There was a problem hiding this comment.
Should we go async here? If I did not miss anything, yq will block Tokio workers since it's running with std::process::Command
| echo "::group::Effective zizmor configuration for $GITHUB_REPOSITORY" | ||
| cat crabwatch-zizmor.yml | ||
| echo "::endgroup::" |
There was a problem hiding this comment.
Since clicking the status check
leads to a job summary, perhaps we could write this (also?) to the job summary, so developers see the config without having to expanding the logs.
There was a problem hiding this comment.
If useful we could do this in another PR 👍
| - name: Run tests | ||
| run: cargo test --workspace | ||
| run: | | ||
| # The config tests shell out to yq; fail early if the runner image drops it. |
There was a problem hiding this comment.
I was not aware that yq comes pre-installed on GH runners. It seems it's been around since 2021, at this point feels unlike they will drop it from runner images
There was a problem hiding this comment.
I reverted this change.
759fd95 to
a8562da
Compare
We can't enable certain zizmor lints because some repositories don't pass them. In this PR, I add a mechanism to disable linters on certain repositories.
In this way, a repository doesn't block lints to be adopted in the organization.
Also enable
archived-usesas an example of lint that is disabled on a repository level.Design decisions
Manual test
set
repositories: {}in the configuration and runGITHUB_TOKEN=$(gh auth token) cargo run -- analyze --org rust-lang. You will see the following error:Error
AI disclosure
I used GPT6-Astra and Fable 5.1 to generate this change. I reviewed its output and changed it where necessary.