From a030542da0524caa7f7bdb996892b18c78d45804 Mon Sep 17 00:00:00 2001 From: Pavel Boldyrev <627562+bpg@users.noreply.github.com> Date: Sat, 20 Jan 2024 22:43:08 -0500 Subject: [PATCH] chore(ci): add link checker, reformat actions code (#944) * chore(ci): add link checker, reformat actions code Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> * chore: use bot app token Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --------- Signed-off-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com> --- .github/workflows/golangci-lint.yml | 3 +- .github/workflows/link-check.yml | 46 ++++++++++++++++++++++++++++ .github/workflows/metrics.yml | 30 +++++++++--------- .github/workflows/publish.yml | 7 ++--- .github/workflows/release-please.yml | 1 - .github/workflows/semgrep.yml | 19 ++++++------ .github/workflows/stale.yaml | 5 ++- .github/workflows/test.yml | 6 ++-- 8 files changed, 77 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/link-check.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 9e27596d..6da75ad0 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -15,7 +15,6 @@ jobs: golangci-lint: runs-on: ubuntu-latest steps: - - name: Checkout uses: actions/checkout@v4 with: @@ -34,7 +33,7 @@ jobs: uses: actions/setup-go@v5 if: steps.filter.outputs.go == 'true' with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - name: Lint code if: steps.filter.outputs.go == 'true' diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml new file mode 100644 index 00000000..63f4600c --- /dev/null +++ b/.github/workflows/link-check.yml @@ -0,0 +1,46 @@ +name: "Link Check" + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 0" + +jobs: + link-check: + runs-on: ubuntu-latest + steps: + - name: Generate Short Lived OAuth App Token + uses: actions/create-github-app-token@c4fa18d55c5d49e6a2793e351ea4938322c61072 # v1.6.4 + id: app-token + with: + app-id: "${{ secrets.BOT_APP_ID }}" + private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" + owner: "${{ github.repository_owner }}" + repositories: "${{ github.event.repository.name }}" + + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Link Checker + uses: lycheeverse/lychee-action@c3089c702fbb949e3f7a8122be0c33c017904f9b # v1.9.1 + id: lychee + env: + GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}" + + - name: Find Link Checker Issue + id: link-checker-issue + uses: micalevisk/last-issue-action@0d40124cc99ac8601c2516007f0c98ef3d27537b # v2.3.0 + with: + state: open + labels: | + broken-links + + - name: Update Issue + uses: peter-evans/create-issue-from-file@433e51abf769039ee20ba1293a088ca19d573b7f # renovate: tag=v4.0.1 + with: + title: Broken links detected 🔗 + issue-number: "${{ steps.link-checker-issue.outputs.issue-number }}" + content-filepath: ./lychee/out.md + token: "${{ steps.app-token.outputs.token }}" + labels: | + broken-links diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index d067545e..76d9885d 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -4,8 +4,8 @@ on: schedule: - cron: "0 0 * * *" # every day at 00:00 UTC (8pm EST) workflow_dispatch: - push: - branches: + push: + branches: - "main" jobs: @@ -14,20 +14,18 @@ jobs: permissions: contents: write steps: - - name: Generate Metrics uses: lowlighter/metrics@latest with: - template: repository - filename: metrics.svg - user: bpg - repo: terraform-provider-proxmox - token: "${{ secrets.METRICS_TOKEN }}" - output_action: gist - committer_gist: 2cc44ead81225542ed1ef0303d8f9eb9 - plugin_lines: yes - plugin_followup: yes - plugin_stargazers: yes - plugin_stargazers_days: 365 - plugin_stargazers_charts_type: graph - + template: repository + filename: metrics.svg + user: bpg + repo: terraform-provider-proxmox + token: "${{ secrets.METRICS_TOKEN }}" + output_action: gist + committer_gist: 2cc44ead81225542ed1ef0303d8f9eb9 + plugin_lines: yes + plugin_followup: yes + plugin_stargazers: yes + plugin_stargazers_days: 365 + plugin_stargazers_charts_type: graph diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e3decd2c..ef72ce71 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,13 +11,12 @@ name: Publish Release on: push: tags: - - 'v*' + - "v*" jobs: goreleaser: runs-on: ubuntu-latest steps: - - name: Generate Short Lived OAuth App Token uses: actions/create-github-app-token@c4fa18d55c5d49e6a2793e351ea4938322c61072 # v1.6.4 id: app-token @@ -32,11 +31,11 @@ jobs: - name: Unshallow run: git fetch --prune --unshallow - + - name: Set up Go uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - name: Import GPG key id: import_gpg diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 6945f1b4..012358ae 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -12,7 +12,6 @@ jobs: permissions: contents: write steps: - - name: Generate Short Lived OAuth App Token uses: actions/create-github-app-token@c4fa18d55c5d49e6a2793e351ea4938322c61072 # v1.6.4 id: app-token diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 0bb98f32..df500f9b 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -1,15 +1,15 @@ name: Semgrep -on: +on: pull_request: {} push: branches: - - main + - main paths: - - .github/workflows/semgrep.yml + - .github/workflows/semgrep.yml schedule: - # random HH:MM to avoid a load spike on GitHub Actions at 00:00 - - cron: 29 16 * * * + # random HH:MM to avoid a load spike on GitHub Actions at 00:00 + - cron: 29 16 * * * jobs: semgrep: @@ -19,9 +19,8 @@ jobs: container: image: returntocorp/semgrep steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Checkout - uses: actions/checkout@v4 - - - name: Semgrep - run: semgrep ci + - name: Semgrep + run: semgrep ci diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index c93e9726..ac9e66da 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -11,7 +11,6 @@ jobs: issues: write pull-requests: write steps: - - name: Generate Short Lived OAuth App Token uses: actions/create-github-app-token@c4fa18d55c5d49e6a2793e351ea4938322c61072 # v1.6.4 id: app-token @@ -27,8 +26,8 @@ jobs: repo-token: "${{ steps.app-token.outputs.token }}" days-before-stale: 180 days-before-close: 30 - exempt-issue-labels: 'needs-triage, acknowledged, in-progress' - exempt-pr-labels: 'needs-review, under-review, acknowledged, planned' + exempt-issue-labels: "needs-triage, acknowledged, in-progress" + exempt-pr-labels: "needs-review, under-review, acknowledged, planned" remove-stale-when-updated: true delete-branch: false stale-issue-label: stale diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5bf96c43..c7240e8a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 5 steps: - - name: Checkout uses: actions/checkout@v4 with: @@ -29,7 +28,7 @@ jobs: if: steps.filter.outputs.go == 'true' uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - name: Get dependencies if: steps.filter.outputs.go == 'true' @@ -43,7 +42,6 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - name: Checkout uses: actions/checkout@v4 with: @@ -61,7 +59,7 @@ jobs: if: steps.filter.outputs.go == 'true' uses: actions/setup-go@v5 with: - go-version-file: 'go.mod' + go-version-file: "go.mod" - name: Get dependencies if: steps.filter.outputs.go == 'true'