From cc4c0502051c1d49e0e5dde01cc225d05dc249be Mon Sep 17 00:00:00 2001 From: Fredrik Baberg Date: Fri, 13 Jan 2023 22:41:53 +0100 Subject: [PATCH] Add workflow for lint, stale --- .github/workflows/lint.yml | 54 +++++++++++++++++++++++++++++++++++++ .github/workflows/stale.yml | 27 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..b46c5c9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,54 @@ +--- +# yamllint disable rule:truthy +name: Lint + +env: + HADOLINT_VERSION: v1.17.2 + SHELLCHECK_OPTS: -e SC1008 -s bash + +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + hadolint: + runs-on: ubuntu-latest + name: hadolint + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Run linter + id: changed_files + run: | + shopt -s globstar + for dockerfile in **/Dockerfile; do + echo "Linting: $dockerfile" + docker run --rm -i \ + -v $(pwd)/.hadolint.yaml:/.hadolint.yaml:ro \ + hadolint/hadolint:${{ env.HADOLINT_VERSION }} < "$dockerfile" + done + + yamllint: + runs-on: ubuntu-latest + name: YAMLLint + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Run YAMLLint + uses: frenck/action-yamllint@v1.3 + + shellcheck: + runs-on: ubuntu-latest + name: ShellCheck + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Run linter + uses: ludeeus/action-shellcheck@1.1.0 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..330a25f --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,27 @@ +--- +# yamllint disable rule:truthy +name: Stale + +on: + schedule: + - cron: "0 * * * *" + workflow_dispatch: + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - name: 30 days stale issues + uses: actions/stale@v7.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-issue-stale: 30 + days-before-issue-close: 7 + operations-per-run: 150 + remove-stale-when-updated: true + stale-issue-label: "stale" + exempt-issue-labels: "pinned,security,Help wanted" + stale-issue-message: > + This issue has been automatically marked as stale because it has + not had recent activity. It will be closed if no further activity + occurs. Thank you for your contributions. \ No newline at end of file