ci: various improvements to workflow

This commit is contained in:
vmfunc
2024-10-15 02:51:52 +02:00
parent aff6fea45d
commit 85654f6aaf
11 changed files with 281 additions and 0 deletions

18
.github/workflows/automatic-rebase.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Automatic Rebase
on:
issue_comment:
types: [created]
jobs:
rebase:
name: Rebase
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
runs-on: ubuntu-latest
steps:
- name: Checkout the latest code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Automatic Rebase
uses: cirrus-actions/rebase@1.8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

18
.github/workflows/check-large-files.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Check Large Files
on:
pull_request:
push:
branches: [main]
jobs:
check-large-files:
name: Check for large files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check for large files
run: |
find . -type f -size +5M | while read file; do
echo "::error file=${file}::File ${file} is larger than 5MB"
done

22
.github/workflows/dependency-review.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: "Dependency Review"
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3
- name: "Dependency Review"
uses: actions/dependency-review-action@v3
continue-on-error: ${{ github.event_name == 'push' }}
- name: "Check Dependency Review Outcome"
if: github.event_name == 'push' && failure()
run: |
echo "::warning::Dependency review failed. Please check the dependencies for potential issues."

25
.github/workflows/language.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Mind your language
on:
issues:
types:
- opened
- edited
issue_comment:
types:
- created
- edited
pull_request_review_comment:
types:
- created
- edited
jobs:
echo_issue_comment:
runs-on: ubuntu-latest
name: profanity check
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Profanity check step
uses: tailaiw/mind-your-language-action@v1.0.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

18
.github/workflows/markdown-lint.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Markdown Lint
on:
pull_request:
paths:
- "**/*.md"
jobs:
markdownlint:
name: runner / markdownlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: markdownlint
uses: reviewdog/action-markdownlint@v0.10.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review

36
.github/workflows/memes.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
name: Memer Workflow
on: [pull_request]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Memer Action
id: memer
uses: Bhupesh-V/memer-action@master
with:
filter: "new"
- name: Check Outputs
run: |
echo "${{ steps.memer.outputs.meme }}"
echo "${{ steps.memer.outputs.title }}"
echo "${{ steps.memer.outputs.source }}"
- name: Create comment
uses: peter-evans/create-or-update-comment@v1.3.0
id: couc
with:
issue-number: ${{ github.event.number }}
body: |
🎉🎉 Thanks for opening this PR/Issue
Please wait while the maintainer(s) review it
Meanwhile have a look at this:
> **${{ steps.memer.outputs.title }}**
![meme](${{ steps.memer.outputs.meme }})
<sub> <a href="${{ steps.memer.outputs.source }}">Source</a> [ Powered By 🔥 <a href="https://github.com/Bhupesh-V/memer-action">Memer Action</a> ]</sub>

20
.github/workflows/misspell.yml vendored Normal file
View File

@@ -0,0 +1,20 @@
name: Misspell Check
on:
pull_request:
push:
branches: [main]
jobs:
misspell:
name: runner / misspell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: misspell
uses: reviewdog/action-misspell@v1.13.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
level: warning
locale: "US"

16
.github/workflows/reportcard.yml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Update Report Card
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_call:
jobs:
update-report-card:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update Go Report Card
uses: creekorful/goreportcard-action@v1.0

71
.github/workflows/reviewdog.yml vendored Normal file
View File

@@ -0,0 +1,71 @@
name: reviewdog
on: [pull_request]
jobs:
# NOTE: golangci-lint doesn't report multiple errors on the same line from
# different linters and just report one of the errors?
golangci-lint:
name: runner / golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
# optionally use a specific version of Go rather than the latest one
go_version: "1.17"
# Can pass --config flag to change golangci-lint behavior and target
# directory.
golangci_lint_flags: "--config=.github/.golangci.yml ./testdata"
workdir: subdirectory/
# Use golint via golangci-lint binary with "warning" level.
golint:
name: runner / golint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: golint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--disable-all -E golint"
tool_name: golint # Change reporter name.
level: warning # GitHub Status Check won't become failure with this level.
# You can add more and more supported linters with different config.
errcheck:
name: runner / errcheck
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: errcheck
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_flags: "--disable-all -E errcheck"
tool_name: errcheck
level: info
# Disable cache of golangci-lint result, go build and go dependencies
with_cache:
name: runner / errcheck
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
cache: false

18
.github/workflows/shellcheck.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
name: Shell Check
on:
pull_request:
paths:
- "**/*.sh"
jobs:
shellcheck:
name: runner / shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: shellcheck
uses: reviewdog/action-shellcheck@v1.18.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review

19
.github/workflows/yaml-lint.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: YAML Lint
on:
pull_request:
paths:
- "**/*.yml"
- "**/*.yaml"
jobs:
yamllint:
name: runner / yamllint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: yamllint
uses: reviewdog/action-yamllint@v1.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review