1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-16 09:16:38 +00:00

Feat: Implemented Github Action linter (#7123)

* ci: add actionlint workflow for GitHub Actions

This workflow integrates actionlint into the CI pipeline to lint and
validate GitHub Actions workflows.

Fixes #7094 

Signed-off-by: slashexx dhruvpuri.35@gmail.com
Co-authored-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Dhruv 2024-11-22 10:35:54 +05:30 committed by GitHub
parent fede8822f8
commit 26e72997e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 44 additions and 22 deletions

22
.github/workflows/actionlint.yml vendored Normal file
View file

@ -0,0 +1,22 @@
name: Lint GitHub action workflows
on:
push:
paths:
- ".github/workflows/**"
pull_request :
paths:
- ".github/workflows/**"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash

View file

@ -22,6 +22,6 @@ jobs:
- name: get changed files
id: changed-files
run: |
echo non-markdown-files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -iv .md$ | xargs) >> $GITHUB_OUTPUT
echo "non-markdown-files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -iv .md$ | xargs)" >> "$GITHUB_OUTPUT"
- run: |
echo "${{ steps.changed-files.outputs.non-markdown-files}}"

View file

@ -24,7 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
@ -54,7 +54,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
@ -84,7 +84,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
@ -103,7 +103,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
@ -121,7 +121,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
@ -134,7 +134,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'

View file

@ -25,8 +25,8 @@ jobs:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: |
cat ".github/env" >> $GITHUB_ENV
echo E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d) >> $GITHUB_ENV
cat ".github/env" >> "$GITHUB_ENV"
echo "E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d)" >> "$GITHUB_ENV"
- name: Install Go
uses: actions/setup-go@v5
with:

View file

@ -30,8 +30,8 @@ jobs:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: |
cat ".github/env" >> $GITHUB_ENV
echo E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d) >> $GITHUB_ENV
cat ".github/env" >> "$GITHUB_ENV"
echo "E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d)" >> "$GITHUB_ENV"
- name: Install Go
uses: actions/setup-go@v5
with:
@ -39,7 +39,7 @@ jobs:
check-latest: true
- name: Build images
run: |
export SHELL=/bin/bash
export SHELL="/bin/bash"
make build image
- name: Start kind cluster
uses: helm/kind-action@v1.10.0

View file

@ -39,8 +39,8 @@ jobs:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: |
cat ".github/env" >> $GITHUB_ENV
echo E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d) >> $GITHUB_ENV
cat ".github/env" >> "$GITHUB_ENV"
echo "E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d)" >> "$GITHUB_ENV"
- name: Install Go
uses: actions/setup-go@v5
with:
@ -48,7 +48,7 @@ jobs:
check-latest: true
- name: Build images
run: |
export SHELL=/bin/bash
export SHELL="/bin/bash"
make build image
- name: Start kind cluster
uses: helm/kind-action@v1.10.0

View file

@ -24,7 +24,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- name: Reclaim disk space
run: |
docker image prune --force --all

View file

@ -12,7 +12,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- name: Install Go
uses: actions/setup-go@v5
with:

View file

@ -18,8 +18,8 @@ jobs:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: |
cat ".github/env" >> $GITHUB_ENV
echo E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d) >> $GITHUB_ENV
cat ".github/env" >> "$GITHUB_ENV"
echo "E2E_DIAGNOSTIC_DIRECTORY=$(mktemp -d)" >> "$GITHUB_ENV"
- name: Install Go
uses: actions/setup-go@v5
with:

View file

@ -23,7 +23,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
run: cat ".github/env" >> "$GITHUB_ENV"
- uses: actions/setup-go@v5
with:
go-version: ${{ env.golang-version }}