CI: add actionlint #539
No reviewers
Labels
No labels
automation
backend
bug
contributor experience
data
deployment
documentation
duplicate
good first issue
help wanted
nice to have
notifications
package maintainer
performance
skin
tech debt
user story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-community/nix-security-tracker#539
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "smelc/smelc/ci-add-actionlint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
While working on plugging CodeQL in this repository, I noticed there was no check on the quality of workflow files, so I'm proposing to add one.
How to trust this PR
I'm not sure I understand this comment - does that apply for this repo?
@ -0,0 +5,4 @@
paths:
- ".github/workflows/**"
push:
branches: main
should we restrict this to PRs that touch the workflows?
@ -0,0 +27,4 @@
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
This basically runs arbitrary code from a 3rd-party repo. When triggered with 'push' or 'workflow_dispatch', I'm pretty sure a GitHub Action runs with access to privileges (the 'permissive' set in https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token).
Could we lock down the token for this workflow? And disable
persist-credentials
for the checkout action above? (https://github.com/actions/checkout/)Indeed sorry, this is coming from another repo of mine. I removed the comment 👍
@ -0,0 +5,4 @@
paths:
- ".github/workflows/**"
push:
branches: main
That makes sense 👍
Done that using a path filter in the additional commit
ci: run actionlint only when .github/workflows/** changes
.@raboof> please make sure to check that the workflow indeed runs on this PR when you approve them.
@ -0,0 +27,4 @@
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
@raboof> set
persist-credentials
to false (thanks, didn't know about this one) and restrictedGITHUB_TOKEN
's rights to the minimum 👍 See the last two commits.@ -0,0 +27,4 @@
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
You might be interested in https://github.com/woodruffw/zizmor that catches this. If you want an example of how it's already used in nixos/infra,
b464b1d870/.github/workflows/zizmor.yml
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.