Skip to content

Commit

Permalink
fix(ci): Labels not quite working
Browse files Browse the repository at this point in the history
  • Loading branch information
szinn committed Mar 18, 2024
1 parent b1b1ab7 commit 9e91a76
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 72 deletions.
13 changes: 6 additions & 7 deletions .github/labeler.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
---
area/github:
- ".github/**/*"
area/cluster:
- "kubernetes/**/*"
- changed-files:
- any-glob-to-any-file: ".github/**/*"
area/hack:
- "hack/**/*"
- changed-files:
- any-glob-to-any-file: "hack/**/*"
area/infrastructure:
- "infrastructure/**/*"
- changed-files:
- any-glob-to-any-file: "infrastructure/**/*"
cluster/main:
- changed-files:
- any-glob-to-any-file: "kubernetes/main/**/*"
- any-glob-to-any-file: "infrastructure/talos/main/**/*"
cluster/staging:
- changed-files:
- any-glob-to-any-file: "kubernetes/staging/**/*"
- any-glob-to-any-file: "infrastructure/talos/staging/**/*"
cluster/nas:
- changed-files:
- any-glob-to-any-file: "kubernetes/nas/**/*"
12 changes: 10 additions & 2 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@
color: "72ccf3"
description: >-
Changes made in the github directory
- name: area/cluster
- name: cluster/main
color: "72ccf3"
description: >-
Changes made in the cluster directory
Changes made in the main cluster
- name: cluster/staging
color: "72ccf3"
description: >-
Changes made in the staging cluster
- name: cluster/nas
color: "72ccf3"
description: >-
Changes made in the nas cluster
- name: area/hack
color: "72ccf3"
description: >-
Expand Down
9 changes: 3 additions & 6 deletions .github/renovate/clusters.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,22 @@
"**/kubernetes/main/**",
"**/infrastructure/talos/main/**"
],
"additionalBranchPrefix": "main-",
"commitMessagePrefix": "[main]"
"additionalBranchPrefix": "main-"
},
{
"description": "Separate PRs for staging cluster",
"matchFileNames": [
"**/kubernetes/staging/**",
"**/infrastructure/talos/staging/**"
],
"additionalBranchPrefix": "staging-",
"commitMessagePrefix": "[staging]"
"additionalBranchPrefix": "staging-"
},
{
"description": "Separate PRs for nas cluster",
"matchFileNames": [
"**/kubernetes/nas/**"
],
"additionalBranchPrefix": "nas-",
"commitMessagePrefix": "[nas]"
"additionalBranchPrefix": "nas-"
}
]
}
5 changes: 3 additions & 2 deletions .github/workflows/create-blacklist.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Build blacklist"

on:
Expand All @@ -13,7 +14,7 @@ jobs:
steps:
- name: Generate Token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: generate-token
id: app-token
with:
app_id: "${{ secrets.BOT_APP_ID }}"
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
Expand Down Expand Up @@ -96,7 +97,7 @@ jobs:
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
with:
release_name: "Pi-Hole Blacklist"
repo_token: ${{ steps.generate-token.outputs.token }}
repo_token: ${{ steps.app-token.outputs.token }}
file: hosts.blacklist
asset_name: hosts.blacklist
tag: pi-hole
Expand Down
60 changes: 48 additions & 12 deletions .github/workflows/link-checker.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,74 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Link Checker

on: # yamllint disable-line rule:truthy
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

env:
WORKFLOW_ISSUE_TITLE: "Link Checker Dashboard 🔗"

jobs:
link-checker:
name: Link Checker
runs-on: ubuntu-latest
steps:
- name: Generate Token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: generate-token
id: app-token
with:
app_id: "${{ secrets.BOT_APP_ID }}"
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: "${{ steps.generate-token.outputs.token }}"
token: "${{ steps.app-token.outputs.token }}"

- name: Setup Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Setup Workflow Tools
shell: bash
run: brew install lychee

- name: Scan For Broken Links
shell: bash
env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
run: |
lychee --verbose --no-progress \
--format markdown \
--output results.md \
--exclude-all-private \
--exclude-mail \
./**/*.md || true
- name: Print Output
run: cat results.md

- name: Link Checker
uses: lycheeverse/lychee-action@c053181aa0c3d17606addfe97a9075a32723548a # v1.9.3
id: lychee
- name: Find Link Checker Issue
id: find-issue
shell: bash
env:
GITHUB_TOKEN: "${{ steps.generate-token.outputs.token }}"
GH_TOKEN: "${{ steps.app-token.outputs.token }}"
run: |
issue_number=$( \
gh issue list \
--search "in:title ${{ env.WORKFLOW_ISSUE_TITLE }}" \
--state open \
--json number \
| jq --raw-output '.[0].number' \
)
echo "issue-number=${issue_number}" >> $GITHUB_OUTPUT
echo "${issue_number}"
- name: Create Issue From File
if: env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@24452a72d85239eacf1468b0f1982a9f3fec4c94 # v5
- name: Create or Update Issue
uses: peter-evans/create-issue-from-file@v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue
token: "${{ steps.app-token.outputs.token }}"
title: "${{ env.WORKFLOW_ISSUE_TITLE }}"
issue-number: "${{ steps.find-issue.outputs.issue-number || '' }}"
content-filepath: results.md
7 changes: 4 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Lint

on: # yamllint disable-line rule:truthy
Expand All @@ -18,21 +19,21 @@ jobs:
steps:
- name: Generate Token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: generate-token
id: app-token
with:
app_id: "${{ secrets.BOT_APP_ID }}"
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: "${{ steps.generate-token.outputs.token }}"
token: "${{ steps.app-token.outputs.token }}"
fetch-depth: 0

- name: MegaLinter
uses: oxsecurity/megalinter@a7a0163b6c8ff7474a283d99a706e27483ddd80f # v7.10.0
env:
GITHUB_TOKEN: "${{ steps.generate-token.outputs.token }}"
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
PRINT_ALPACA: false
VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'workflow_dispatch' }}
ENABLE_LINTERS: |-
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/meta-enforce-labels.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Meta - Enforce PR labels

on: # yamllint disable-line rule:truthy
Expand Down
34 changes: 0 additions & 34 deletions .github/workflows/meta-label-size.yaml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/meta-labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: "Meta - Labeler"

on:
workflow_dispatch:
pull_request_target:
branches: ["main"]

jobs:
labeler:
name: Labeler
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Generate Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: "${{ steps.app-token.outputs.token }}"

- name: Labeler
uses: actions/labeler@v5
with:
repo-token: "${{ steps.app-token.outputs.token }}"
configuration-path: .github/labeler.yaml

- name: Label Size
uses: pascalgn/size-label-action@37a5ad4ae20ea8032abf169d953bcd661fd82cd3 # v0.5.0
env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"
with:
sizes: >
{
"0": "XS",
"20": "S",
"50": "M",
"200": "L",
"800": "XL",
"2000": "XXL"
}
7 changes: 4 additions & 3 deletions .github/workflows/meta-sync-labels.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Meta - Sync labels

on: # yamllint disable-line rule:truthy
Expand All @@ -16,19 +17,19 @@ jobs:
steps:
- name: Generate Token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: generate-token
id: app-token
with:
app_id: "${{ secrets.BOT_APP_ID }}"
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: "${{ steps.generate-token.outputs.token }}"
token: "${{ steps.app-token.outputs.token }}"

- name: Sync Labels
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2
with:
config-file: .github/labels.yaml
token: "${{ steps.generate-token.outputs.token }}"
token: "${{ steps.app-token.outputs.token }}"
delete-other-labels: true
6 changes: 3 additions & 3 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ jobs:
steps:
- name: Generate Token
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: generate-token
id: app-token
with:
app_id: "${{ secrets.BOT_APP_ID }}"
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: "${{ steps.generate-token.outputs.token }}"
token: "${{ steps.app-token.outputs.token }}"

- name: Override default config from dispatch variables
run: |
Expand All @@ -66,5 +66,5 @@ jobs:
uses: renovatebot/github-action@89bd050bafa5a15de5d9383e3129edf210422004 # v40.1.5
with:
configurationFile: .github/renovate.json5
token: "${{ steps.generate-token.outputs.token }}"
token: "${{ steps.app-token.outputs.token }}"
renovate-version: "${{ env.WORKFLOW_RENOVATE_VERSION }}"

0 comments on commit 9e91a76

Please sign in to comment.