Skip to content

Commit

Permalink
ci: limit permissions of GITHUB_TOKEN and add actionlint (#1227)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Jan 21, 2025
1 parent 925af59 commit 4168a95
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
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

0 comments on commit 4168a95

Please sign in to comment.