From fb8c4192abf153281d40d4996cc88d43e176e7ab Mon Sep 17 00:00:00 2001 From: Kwitsch Date: Tue, 14 Nov 2023 23:22:27 +0100 Subject: [PATCH] Bugfix/GitHub workflows (#1234) * added github-actions * removed default config entries * configured prettier as formatter for github workflows * runs every day to prevent running into api limits --- .devcontainer/devcontainer.json | 30 ++++++++-------------- .github/workflows/close_stale.yml | 13 ++++------ .github/workflows/codeql-analysis.yml | 16 +++++++----- .github/workflows/delete-workflow-runs.yml | 29 --------------------- .github/workflows/docs.yml | 7 ++++- .github/workflows/fork-sync.yml | 8 +----- .github/workflows/mirror-repo.yml | 26 +++++++++---------- .github/workflows/release.yml | 3 +++ 8 files changed, 47 insertions(+), 85 deletions(-) delete mode 100644 .github/workflows/delete-workflow-runs.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 51a6be183..2b0da1d91 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,14 +17,15 @@ "customizations": { "vscode": { "extensions": [ - "golang.go", - "esbenp.prettier-vscode", - "yzhang.markdown-all-in-one", - "joselitofilho.ginkgotestexplorer", - "fsevenm.run-it-on", - "markis.code-coverage", - "tooltitudeteam.tooltitude" - ], + "golang.go", + "esbenp.prettier-vscode", + "yzhang.markdown-all-in-one", + "joselitofilho.ginkgotestexplorer", + "fsevenm.run-it-on", + "markis.code-coverage", + "tooltitudeteam.tooltitude", + "GitHub.vscode-github-actions" + ], "settings": { "go.lintFlags": ["--config=${containerWorkspaceFolder}/.golangci.yml"], "go.alternateTools": { @@ -33,20 +34,11 @@ "[go]": { "editor.defaultFormatter": "golang.go" }, - "[json][jsonc]": { + "[json][jsonc][github-actions-workflow]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[markdown]": { - "editor.defaultFormatter": "yzhang.markdown-all-in-one", - "editor.unicodeHighlight.ambiguousCharacters": false, - "editor.unicodeHighlight.invisibleCharacters": false, - "diffEditor.ignoreTrimWhitespace": false, - "editor.wordWrap": "on", - "editor.quickSuggestions": { - "comments": "off", - "strings": "off", - "other": "off" - } + "editor.defaultFormatter": "yzhang.markdown-all-in-one" } } } diff --git a/.github/workflows/close_stale.yml b/.github/workflows/close_stale.yml index 1c5105251..62a7f3cdb 100644 --- a/.github/workflows/close_stale.yml +++ b/.github/workflows/close_stale.yml @@ -1,8 +1,12 @@ -name: "Close stale issues and PRs" +name: Close stale issues and PRs + on: schedule: - cron: "0 4 * * *" +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + jobs: stale: runs-on: ubuntu-latest @@ -23,10 +27,3 @@ jobs: days-before-pr-close: 10 exempt-all-milestones: true operations-per-run: 60 - - - name: Delete old runs - uses: Mattraks/delete-workflow-runs@v2 - with: - token: ${{ github.token }} - repository: ${{ github.repository }} - delete_workflow_pattern: close_stale.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ac4f47b1b..e6926777a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,31 +1,33 @@ -name: "CodeQL" +name: CodeQL on: push: - branches: + branches: - main pull_request: - branches: + branches: - main schedule: - - cron: '33 15 * * 1' + - cron: "33 15 * * 1" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} jobs: analyze: name: Analyze runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - # Use Golang cache - name: Setup Golang uses: actions/setup-go@v4 with: go-version-file: go.mod - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: diff --git a/.github/workflows/delete-workflow-runs.yml b/.github/workflows/delete-workflow-runs.yml deleted file mode 100644 index 6c8eb64c2..000000000 --- a/.github/workflows/delete-workflow-runs.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Delete workflow runs - -on: - schedule: - - cron: "0 1 * * *" - workflow_dispatch: - -jobs: - del_runs: - name: Delete workflow runs - runs-on: ubuntu-latest - steps: - - name: Delete skipped - uses: Mattraks/delete-workflow-runs@v2 - with: - token: ${{ github.token }} - repository: ${{ github.repository }} - retain_days: 0 - keep_minimum_runs: 0 - delete_run_by_conclusion_pattern: skipped - - - name: Delete cancelled - uses: Mattraks/delete-workflow-runs@v2 - with: - token: ${{ github.token }} - repository: ${{ github.repository }} - retain_days: 0 - keep_minimum_runs: 0 - delete_run_by_conclusion_pattern: cancelled diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 2295aa084..5c1f7301f 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,10 +1,15 @@ name: docs + on: push: branches: - - '**' + - "**" tags: - v* + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + jobs: deploy: runs-on: ubuntu-latest diff --git a/.github/workflows/fork-sync.yml b/.github/workflows/fork-sync.yml index 2e8b23e86..cc044fada 100644 --- a/.github/workflows/fork-sync.yml +++ b/.github/workflows/fork-sync.yml @@ -7,6 +7,7 @@ on: concurrency: group: ${{ github.workflow }} + cancel-in-progress: true jobs: sync: @@ -35,10 +36,3 @@ jobs: shell: bash run: | gh repo sync ${{ github.repository }} -b main - - - name: Delete old runs - uses: Mattraks/delete-workflow-runs@v2 - with: - token: ${{ github.token }} - repository: ${{ github.repository }} - delete_workflow_pattern: fork-sync.yml diff --git a/.github/workflows/mirror-repo.yml b/.github/workflows/mirror-repo.yml index aa3044991..ad95c6164 100644 --- a/.github/workflows/mirror-repo.yml +++ b/.github/workflows/mirror-repo.yml @@ -1,26 +1,24 @@ name: mirror git repo + on: push: branches: - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + jobs: mirror: runs-on: ubuntu-latest if: github.repository_owner == '0xERR0R' steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - - uses: yesolutions/mirror-action@master - with: - REMOTE: 'https://codeberg.org/0xERR0R/blocky.git' - GIT_USERNAME: 0xERR0R - GIT_PASSWORD: ${{ secrets.CODEBERG_TOKEN }} - - - name: Delete old runs - uses: Mattraks/delete-workflow-runs@v2 + - uses: yesolutions/mirror-action@master with: - token: ${{ github.token }} - repository: ${{ github.repository }} - delete_workflow_pattern: mirror-repo.yml + REMOTE: "https://codeberg.org/0xERR0R/blocky.git" + GIT_USERNAME: 0xERR0R + GIT_PASSWORD: ${{ secrets.CODEBERG_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 332ea3897..af7e7ff30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,9 @@ on: tags: - v* +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + jobs: build: runs-on: ubuntu-latest