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

ci: limit permissions of GITHUB_TOKEN and add actionlint #1227

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
- release/kong-3.x
workflow_dispatch: {}

permissions:
contents: read

env:
# Specify this here because these tests rely on ktf to run kind for cluster creation.
KIND_VERSION: v0.23.0
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- main
- release/kong-2.x

permissions:
contents: read

env:
# Specify this here because these tests rely on ktf to run kind for cluster creation.
KIND_VERSION: v0.23.0
Expand Down Expand Up @@ -71,6 +74,8 @@ jobs:
timeout-minutes: 30
needs: lint-test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
2 changes: 2 additions & 0 deletions .tools_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ kube-linter: "0.7.1"
chartsnap: "0.4.3"
# renovate: datasource=github-releases depName=koalaman/shellcheck
shellcheck: "0.10.0"
# renovate: datasource=github-releases depName=rhysd/actionlint
actionlint: "1.7.7"
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,18 @@ shellcheck: mise
@$(MAKE) mise-plugin-install DEP=shellcheck
@$(MAKE) mise-install DEP_VER=shellcheck@$(SHELLCHECK_VERSION)

ACTIONLINT_VERSION = $(shell yq -r '.actionlint' < $(TOOLS_VERSIONS_FILE))
ACTIONLINT = $(PROJECT_DIR)/bin/installs/actionlint/$(ACTIONLINT_VERSION)/bin/actionlint
.PHONY: download.actionlint
download.actionlint: mise ## Download actionlint locally if necessary.
@$(MISE) plugin install --yes -q actionlint
@$(MISE) install -q actionlint@$(ACTIONLINT_VERSION)

.PHONY: tools
tools: kube-linter chartsnap shellcheck

.PHONY: lint
lint: tools lint.charts lint.shellcheck
lint: tools lint.charts lint.shellcheck lint.actions

.PHONY: lint.charts
lint.charts:
Expand All @@ -53,6 +60,12 @@ lint.shellcheck: shellcheck
$(SHELLCHECK) ./scripts/*
$(SHELLCHECK) ./charts/gateway-operator/scripts/*

.PHONY: lint.actions
lint.actions: download.actionlint shellcheck
# TODO: add more files to be checked
$(ACTIONLINT) -shellcheck $(SHELLCHECK) \
./.github/workflows/*

.PHONY: test.golden
test.golden:
@ \
Expand Down
Loading