From 2a21fb0f17a4d07763effe48af923091fc88d1d0 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 01/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA --- .github/workflows/linguist.yml | 113 +++++++++++++++++++++++++++ internal/generate/knownfiles/main.go | 3 +- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/linguist.yml diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml new file mode 100644 index 00000000..c93070e2 --- /dev/null +++ b/.github/workflows/linguist.yml @@ -0,0 +1,113 @@ +# GitHub Actions Workflow: Linguist +# This workflow file defines automation tasks for the Linguist tool +--- +name: Linguist SHA update + +on: + schedule: + - cron: '0 0 * * 1' # every monday at midnight + +permissions: + contents: write + pull-requests: write + +jobs: + update-sha: + name: Update Linguist SHA + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Fetch latest Linguist SHA + id: fetch-sha + run: | + SHA=$(git ls-remote https://github.com/github/linguist.git HEAD | awk '{print $1}') + [[ -z "$SHA" ]] && { echo "Empty output"; exit 1; } + [[ ! "$SHA" =~ ^[0-9a-f]{40}$ ]] && { echo "Invalid SHA format"; exit 1; } + + echo "sha=$SHA" >> "$GITHUB_OUTPUT" + + - name: Update pinned SHA in internal/generate/knownfiles/main.go + id: update-sha + run: | + FILEPATH=internal/generate/knownfiles/main.go + SHA_REGEX='[0-9a-f]{40}' + FIELD_REGEX='linguistSHA\s*=\s*"' + + if ! grep -qE 'linguistSHA\s*=\s*"[0-9a-f]{40}"' "$FILEPATH"; then + echo "Missing linguistSHA line" + exit 1 + fi + + EXISTING_SHA=$(grep -oE "${FIELD_REGEX}${SHA_REGEX}" "$FILEPATH" | grep -oE "$SHA_REGEX") + + if [[ "$EXISTING_SHA" == "$SHA" ]]; then + echo "SHA already up to date, skipping" + exit 0 + fi + + sed -E -i "s/(${FIELD_REGEX})${SHA_REGEX}(\")/\1$SHA\2/" "$FILEPATH" + + if git diff --quiet; then + echo "sha_updated=false" >> "$GITHUB_OUTPUT" + else + echo "sha_updated=true" >> "$GITHUB_OUTPUT" + fi + + - name: Commit changes + if: steps.update-sha.outputs.sha_updated == 'true' + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add internal/generate/knownfiles/main.go + git commit -m "chore: update github-linguist SHA" + + - name: Create branch and push + id: create-branch + if: steps.update-sha.outputs.sha_updated == 'true' + run: | + BRANCH="autopr/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" + git checkout -b "$BRANCH" + git push --set-upstream origin "$BRANCH" + echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" + + - name: Check existing PR + id: pr-check + if: steps.update-sha.outputs.sha_updated == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + EXISTS=$(gh pr list \ + --head "${{ steps.create-branch.outputs.branch }}" \ + --json number \ + --jq 'length') + + if [[ "$EXISTS" != "0" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create pull request + if: steps.update-sha.outputs.sha_updated == 'true' && steps.pr-check.outputs.skip != 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create \ + --title "chore: update github-linguist SHA to ${{ steps.fetch-sha.outputs.sha }}" \ + --body "## Automated SHA bump + + Bumps the pinned [github/linguist](https://github.com/github/linguist) SHA in the file [internal/generate/knownfiles/main.go](internal/generate/knownfiles/main.go) to the latest version. + + > This PR was automatically created by workflow run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" \ + --base ${{ github.event.repository.default_branch }} \ + --head ${{ steps.create-branch.outputs.branch }} + + - name: Cleanup branch on failure + if: failure() && steps.create-branch.outputs.branch != '' + run: | + git push origin --delete "${{ steps.create-branch.outputs.branch }}" || true \ No newline at end of file diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index dc5cf359..4983d537 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,8 @@ import ( ) const ( - linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/refs/heads/main/lib/linguist/languages.yml" + linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" + linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) From 5329c32549883baa0b51ffbad7e9a3f736dc6dbd Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 02/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index c93070e2..776d1e7b 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -6,7 +6,8 @@ name: Linguist SHA update on: schedule: - cron: '0 0 * * 1' # every monday at midnight - + workflow_dispatch: + permissions: contents: write pull-requests: write From 2028fc3abfacd396ca04eb96ab67864c73fe2521 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 03/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 776d1e7b..383b405b 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -7,6 +7,11 @@ on: schedule: - cron: '0 0 * * 1' # every monday at midnight workflow_dispatch: + inputs: + force: + description: "Force update" + required: false + default: "false" permissions: contents: write @@ -111,4 +116,4 @@ jobs: - name: Cleanup branch on failure if: failure() && steps.create-branch.outputs.branch != '' run: | - git push origin --delete "${{ steps.create-branch.outputs.branch }}" || true \ No newline at end of file + git push origin --delete "${{ steps.create-branch.outputs.branch }}" || true From 3dc854190850bbd16809d43cb1b901ea2f628f8c Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 04/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 383b405b..cf91a0f2 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -12,7 +12,6 @@ on: description: "Force update" required: false default: "false" - permissions: contents: write pull-requests: write From 1023c60020cc6bc9f337ca3d5c870ef75428da61 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 05/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 8 ++------ internal/generate/knownfiles/main.go | 1 + 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index cf91a0f2..88f90941 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -6,12 +6,8 @@ name: Linguist SHA update on: schedule: - cron: '0 0 * * 1' # every monday at midnight - workflow_dispatch: - inputs: - force: - description: "Force update" - required: false - default: "false" + workflow_dispatch: # yamllint disable-line rule:truthy - false positive + permissions: contents: write pull-requests: write diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 4983d537..696c3786 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,6 +25,7 @@ import ( ) const ( + // devskim:ignore DS173237 - this is a commit SHA, not a secret linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" From 47adb82a38b73aad49e88863ada359516d2338f8 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 06/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA enable manual triggering for Linguist SHA update workflow --- internal/generate/knownfiles/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 696c3786..e6f76e5a 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - // devskim:ignore DS173237 - this is a commit SHA, not a secret + // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" From 41f0ecf3fe4c35898963180a5e8ea634a0917d30 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 07/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- internal/generate/knownfiles/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index e6f76e5a..9e852476 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,8 +25,7 @@ import ( ) const ( - // DevSkim: ignore DS173237 - this is a commit SHA, not a secret - linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" + linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) From 367b787ae4e3ba66ba2edc88564c49dbe81d2e5c Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 10:20:05 +0200 Subject: [PATCH 08/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 8 +++++--- internal/generate/knownfiles/main.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 88f90941..e1255958 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -9,9 +9,7 @@ on: workflow_dispatch: # yamllint disable-line rule:truthy - false positive permissions: - contents: write - pull-requests: write - + contents: read jobs: update-sha: name: Update Linguist SHA @@ -34,6 +32,8 @@ jobs: - name: Update pinned SHA in internal/generate/knownfiles/main.go id: update-sha + permissions: + contents: write run: | FILEPATH=internal/generate/knownfiles/main.go SHA_REGEX='[0-9a-f]{40}' @@ -95,6 +95,8 @@ jobs: - name: Create pull request if: steps.update-sha.outputs.sha_updated == 'true' && steps.pr-check.outputs.skip != 'true' + permissions: + pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 9e852476..e06db7dd 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) From baffafba0e8d140d7a5cdab39e8e216097e4b676 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 11:59:19 +0200 Subject: [PATCH 09/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index e1255958..7e67f450 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -8,13 +8,13 @@ on: - cron: '0 0 * * 1' # every monday at midnight workflow_dispatch: # yamllint disable-line rule:truthy - false positive -permissions: - contents: read jobs: update-sha: name: Update Linguist SHA runs-on: ubuntu-latest - + permissions: + contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 @@ -32,8 +32,6 @@ jobs: - name: Update pinned SHA in internal/generate/knownfiles/main.go id: update-sha - permissions: - contents: write run: | FILEPATH=internal/generate/knownfiles/main.go SHA_REGEX='[0-9a-f]{40}' @@ -95,8 +93,6 @@ jobs: - name: Create pull request if: steps.update-sha.outputs.sha_updated == 'true' && steps.pr-check.outputs.skip != 'true' - permissions: - pull-requests: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From ac577ecc3d89637b8e3fc0d2183a6eef90130a53 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 12:05:01 +0200 Subject: [PATCH 10/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 7e67f450..8f7654e0 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -17,7 +17,7 @@ jobs: pull-requests: write steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with: fetch-depth: 0 From 31d551a84b809aad6e1e6f9c75b581c2176446e5 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 12:05:13 +0200 Subject: [PATCH 11/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 8f7654e0..46789fec 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -7,6 +7,10 @@ on: schedule: - cron: '0 0 * * 1' # every monday at midnight workflow_dispatch: # yamllint disable-line rule:truthy - false positive + +permissions: + contents: read + pull-requests: read jobs: update-sha: @@ -17,7 +21,7 @@ jobs: pull-requests: write steps: - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 From e7a264458b4ba645214faea5f0bc4b99d0970b46 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 12:12:54 +0200 Subject: [PATCH 12/45] Changelog entry about linguist added --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d1e9336..24f7ee9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - JSON and JSONC treated as a family for `--file-types` and `--exclude-file-types` - `go generate` step in CI pipeline to keep Linguist data fresh - CI lint check to ensure generated files are committed up to date +- Automated Linguist SHA updates via scheduled GitHub Actions workflow (`linguist.yml`) that checks SHA weekly ### Fixed From 16dd33faef842e875db2668024294c12db107ff9 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 12:33:22 +0200 Subject: [PATCH 13/45] re-generated known_files_gen.go --- pkg/filetype/known_files_gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index 786d86a1..398bf0f2 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/refs/heads/main/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml package filetype From de786a9aad423fca2e04f20a2f6ff91670a3249e Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 12:36:13 +0200 Subject: [PATCH 14/45] chore: update GitHub Actions workflow to generate known_files_gen.go and include it in commit --- .github/workflows/linguist.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 46789fec..09bdb0ee 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -7,7 +7,7 @@ on: schedule: - cron: '0 0 * * 1' # every monday at midnight workflow_dispatch: # yamllint disable-line rule:truthy - false positive - + permissions: contents: read pull-requests: read @@ -61,12 +61,16 @@ jobs: echo "sha_updated=true" >> "$GITHUB_OUTPUT" fi + - name: Generate known_files_gen.go + if: steps.update-sha.outputs.sha_updated == 'true' + run: go generate ./internal/generate/knownfiles + - name: Commit changes if: steps.update-sha.outputs.sha_updated == 'true' run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git add internal/generate/knownfiles/main.go + git add internal/generate/knownfiles/main.go pkg/filetype/known_files_gen.go git commit -m "chore: update github-linguist SHA" - name: Create branch and push From 54dbdb13fa12287a349566326be840342a999ac3 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 13:24:30 +0200 Subject: [PATCH 15/45] chore: add GitHub Actions workflow to update linguist SHA and modify main.go to use dynamic SHA, enable manual triggering for Linguist SHA update workflow --- .github/workflows/linguist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 09bdb0ee..a8036505 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -48,12 +48,12 @@ jobs: EXISTING_SHA=$(grep -oE "${FIELD_REGEX}${SHA_REGEX}" "$FILEPATH" | grep -oE "$SHA_REGEX") - if [[ "$EXISTING_SHA" == "$SHA" ]]; then + if [[ "$EXISTING_SHA" == "${{ steps.fetch-sha.outputs.sha }}" ]]; then echo "SHA already up to date, skipping" exit 0 fi - sed -E -i "s/(${FIELD_REGEX})${SHA_REGEX}(\")/\1$SHA\2/" "$FILEPATH" + sed -E -i "s/(${FIELD_REGEX})${SHA_REGEX}(\")/\1${{ steps.fetch-sha.outputs.sha }}\2/" "$FILEPATH" if git diff --quiet; then echo "sha_updated=false" >> "$GITHUB_OUTPUT" From 043e54e343e22663c3b49ec1d187b35d92fafe0f Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 13:37:45 +0200 Subject: [PATCH 16/45] test: main + known_files --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index e06db7dd..8e895014 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index 398bf0f2..b8a4f419 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml package filetype From b09ca966561eca20fcb08344cfd8bfecc88fe7a4 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 13:52:24 +0200 Subject: [PATCH 17/45] known_files_gen step fix --- .github/workflows/linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index a8036505..e5f6b6e9 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -63,7 +63,7 @@ jobs: - name: Generate known_files_gen.go if: steps.update-sha.outputs.sha_updated == 'true' - run: go generate ./internal/generate/knownfiles + run: go run ./internal/generate/knownfiles - name: Commit changes if: steps.update-sha.outputs.sha_updated == 'true' From 33e7a7c8c6183aa78b0bd891e0bb65df947576ff Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 14:13:59 +0200 Subject: [PATCH 18/45] chore: update command to generate known_files_gen.go using 'go generate' --- .github/workflows/linguist.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index e5f6b6e9..453eb480 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -61,9 +61,9 @@ jobs: echo "sha_updated=true" >> "$GITHUB_OUTPUT" fi - - name: Generate known_files_gen.go - if: steps.update-sha.outputs.sha_updated == 'true' - run: go run ./internal/generate/knownfiles + - name: Generate known_files_gen.go + if: steps.update-sha.outputs.sha_updated == 'true' + run: go generate ./internal/generate/knownfiles - name: Commit changes if: steps.update-sha.outputs.sha_updated == 'true' From c947c4ecd789fca3e9a6001067ffe4e2b3499c5e Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 14:16:25 +0200 Subject: [PATCH 19/45] chore: format YAML for generating known_files_gen.go step --- .github/workflows/linguist.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 453eb480..a8036505 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -61,9 +61,9 @@ jobs: echo "sha_updated=true" >> "$GITHUB_OUTPUT" fi - - name: Generate known_files_gen.go - if: steps.update-sha.outputs.sha_updated == 'true' - run: go generate ./internal/generate/knownfiles + - name: Generate known_files_gen.go + if: steps.update-sha.outputs.sha_updated == 'true' + run: go generate ./internal/generate/knownfiles - name: Commit changes if: steps.update-sha.outputs.sha_updated == 'true' From 727473e68b1a813350b323f5a2b1dab423bcf5e1 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 14:29:24 +0200 Subject: [PATCH 20/45] chore: update usage instructions for local command execution in knownfiles generator --- internal/generate/knownfiles/main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 8e895014..cc68130f 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -5,9 +5,12 @@ // It maps Linguist language names to config-file-validator file types and extracts // the "filenames" entries for each supported type. // -// Usage: +// Manually running this command should not be necessary, as it's invoked by the GitHub Actions workflow. +// However, if you want to run it locally, make sure to update the linguistSHA constant to the latest commit SHA of GitHub Linguist before running. +// Command to run locally: +// go generate ./pkg/filetype/... // -// go run ./internal/generate/knownfiles +//go:generate go run ../../internal/generate/knownfiles package main import ( From 12cfd15caa2b180a090be907b73390455663dd62 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 14:38:43 +0200 Subject: [PATCH 21/45] chore: update go:generate command for knownfiles generation --- internal/generate/knownfiles/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index cc68130f..34f757a5 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -1,5 +1,7 @@ //go:build ignore +//go:generate go run ../../internal/generate/knownfiles + // Command knownfiles generates known_files_gen.go from GitHub Linguist's languages.yml. // // It maps Linguist language names to config-file-validator file types and extracts @@ -8,9 +10,9 @@ // Manually running this command should not be necessary, as it's invoked by the GitHub Actions workflow. // However, if you want to run it locally, make sure to update the linguistSHA constant to the latest commit SHA of GitHub Linguist before running. // Command to run locally: -// go generate ./pkg/filetype/... // -//go:generate go run ../../internal/generate/knownfiles +// go generate ./pkg/filetype/... + package main import ( From 673f338b84a8e41396fd435b076851df38ec81de Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 14:46:18 +0200 Subject: [PATCH 22/45] chore: update generate command in workflow and improve comments in main.go --- .github/workflows/linguist.yml | 4 +++- internal/generate/knownfiles/main.go | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index a8036505..f6706c8c 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -63,7 +63,9 @@ jobs: - name: Generate known_files_gen.go if: steps.update-sha.outputs.sha_updated == 'true' - run: go generate ./internal/generate/knownfiles + run: | + go generate ./internal/generate/knownfiles + git diff pkg/filetype/known_files_gen.go - name: Commit changes if: steps.update-sha.outputs.sha_updated == 'true' diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 34f757a5..5fc60b95 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -7,9 +7,9 @@ // It maps Linguist language names to config-file-validator file types and extracts // the "filenames" entries for each supported type. // -// Manually running this command should not be necessary, as it's invoked by the GitHub Actions workflow. +// Manually running this command should not be necessary, as it's invoked by the GitHub Actions workflow. // However, if you want to run it locally, make sure to update the linguistSHA constant to the latest commit SHA of GitHub Linguist before running. -// Command to run locally: +// Command to run locally: // // go generate ./pkg/filetype/... From c54887dcc82a0abe71bdbb0cbce77ab4c02ae04c Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 14:52:09 +0200 Subject: [PATCH 23/45] chore: remove build constraint from knownfiles generator command --- internal/generate/knownfiles/main.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 5fc60b95..fab9c3d7 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -1,5 +1,3 @@ -//go:build ignore - //go:generate go run ../../internal/generate/knownfiles // Command knownfiles generates known_files_gen.go from GitHub Linguist's languages.yml. From 886640ffa9c28c433c8b050800e2243483e2dc82 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 13 May 2026 12:53:59 +0000 Subject: [PATCH 24/45] chore: Updated coverage badge. --- README.md | 2 +- index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b3d02466..b4ac1114 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

-Code Coverage +Code Coverage OpenSSF Scorecard diff --git a/index.md b/index.md index 17904d55..c57b9c6d 100644 --- a/index.md +++ b/index.md @@ -5,7 +5,7 @@ canonical_url: https://boeing.github.io/config-file-validator/ ---

-Code Coverage +Code Coverage OpenSSF Scorecard From ad8281e93faea2a5c2c723f721daa4b62b4ba253 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 14:55:20 +0200 Subject: [PATCH 25/45] chore: update go:generate command to run from current directory --- internal/generate/knownfiles/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index fab9c3d7..98c5a645 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -1,4 +1,4 @@ -//go:generate go run ../../internal/generate/knownfiles +//go:generate go run . // Command knownfiles generates known_files_gen.go from GitHub Linguist's languages.yml. // From 0d67ac57fb73896b379f844d7e0dc47f9fec7891 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 15:12:53 +0200 Subject: [PATCH 26/45] chore: update go:generate command to run from the correct relative path --- internal/generate/knownfiles/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 98c5a645..72433ff1 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -1,4 +1,4 @@ -//go:generate go run . +//go:generate go run ../../../internal/generate/knownfiles // Command knownfiles generates known_files_gen.go from GitHub Linguist's languages.yml. // From 082850aa227fdb0fb2d510a370a9b25d4cd1154d Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 16:25:24 +0200 Subject: [PATCH 27/45] reverert main.go comment --- internal/generate/knownfiles/main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 72433ff1..8e895014 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -1,16 +1,13 @@ -//go:generate go run ../../../internal/generate/knownfiles +//go:build ignore // Command knownfiles generates known_files_gen.go from GitHub Linguist's languages.yml. // // It maps Linguist language names to config-file-validator file types and extracts // the "filenames" entries for each supported type. // -// Manually running this command should not be necessary, as it's invoked by the GitHub Actions workflow. -// However, if you want to run it locally, make sure to update the linguistSHA constant to the latest commit SHA of GitHub Linguist before running. -// Command to run locally: +// Usage: // -// go generate ./pkg/filetype/... - +// go run ./internal/generate/knownfiles package main import ( From c68a38beb6b89096514d78e1eed8c5543203400d Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 16:27:22 +0200 Subject: [PATCH 28/45] chore: update go:generate command to reference the correct file path --- .github/workflows/linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index f6706c8c..01e28e4f 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -64,7 +64,7 @@ jobs: - name: Generate known_files_gen.go if: steps.update-sha.outputs.sha_updated == 'true' run: | - go generate ./internal/generate/knownfiles + go generate ./pkg/filetype/file_type.go git diff pkg/filetype/known_files_gen.go - name: Commit changes From 0063ec3d4accef8b710e6180a18a533dce7bc234 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 13 May 2026 14:29:11 +0000 Subject: [PATCH 29/45] chore: Updated coverage badge. --- README.md | 2 +- index.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b4ac1114..b3d02466 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

-Code Coverage +Code Coverage OpenSSF Scorecard diff --git a/index.md b/index.md index c57b9c6d..17904d55 100644 --- a/index.md +++ b/index.md @@ -5,7 +5,7 @@ canonical_url: https://boeing.github.io/config-file-validator/ ---

-Code Coverage +Code Coverage OpenSSF Scorecard From 2fc8140cf844ca908b97429d2347a32e4042fc79 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 16:34:16 +0200 Subject: [PATCH 30/45] chore: update PR body to include regeneration of known_files_gen.go with updated SHA --- .github/workflows/linguist.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 01e28e4f..1a0e126f 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -111,7 +111,8 @@ jobs: --body "## Automated SHA bump Bumps the pinned [github/linguist](https://github.com/github/linguist) SHA in the file [internal/generate/knownfiles/main.go](internal/generate/knownfiles/main.go) to the latest version. - + Also regenerates the [pkg/filetype/known_files_gen.go](pkg/filetype/known_files_gen.go) file with the updated SHA and includes it in the PR. + > This PR was automatically created by workflow run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" \ --base ${{ github.event.repository.default_branch }} \ --head ${{ steps.create-branch.outputs.branch }} From d9101e04af5efa61ca60bb52def3ebd92b450842 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 13 May 2026 14:36:20 +0000 Subject: [PATCH 31/45] chore: update github-linguist SHA --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 8e895014..e06db7dd 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index b8a4f419..398bf0f2 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml package filetype From 04bcca89cdaaaa1d928c75541c9d42ec874ffaa7 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 16:39:10 +0200 Subject: [PATCH 32/45] Revert "chore: update github-linguist SHA to e535c9adf5306132e9df0b75ffe1ce2679873fe8" --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index e06db7dd..8e895014 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index 398bf0f2..b8a4f419 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml package filetype From 68024e0dbeb1d35c1e03d5aceee2995ff83355d8 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 13 May 2026 14:40:14 +0000 Subject: [PATCH 33/45] chore: update github-linguist SHA --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 8e895014..e06db7dd 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index b8a4f419..398bf0f2 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml package filetype From a415b81161dbaeac7de191956cab07eab739cfb0 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 16:41:22 +0200 Subject: [PATCH 34/45] Revert "chore: update github-linguist SHA to e535c9adf5306132e9df0b75ffe1ce2679873fe8" --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index e06db7dd..8e895014 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index 398bf0f2..b8a4f419 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml package filetype From 0e0c166e3033b49977d4d4daca46d9f5fec7839e Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 13 May 2026 14:44:48 +0000 Subject: [PATCH 35/45] chore: update github-linguist SHA --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 8e895014..e06db7dd 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index b8a4f419..398bf0f2 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml package filetype From df2cd1c0198b1fef6fed88ac6700b5f3d29c7d89 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 16:36:17 +0200 Subject: [PATCH 36/45] chore: rename workflow to 'Linguist update' for clarity --- .github/workflows/linguist.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 1a0e126f..cc2a78a3 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -1,7 +1,7 @@ # GitHub Actions Workflow: Linguist # This workflow file defines automation tasks for the Linguist tool --- -name: Linguist SHA update +name: Linguist update on: schedule: @@ -112,7 +112,7 @@ jobs: Bumps the pinned [github/linguist](https://github.com/github/linguist) SHA in the file [internal/generate/knownfiles/main.go](internal/generate/knownfiles/main.go) to the latest version. Also regenerates the [pkg/filetype/known_files_gen.go](pkg/filetype/known_files_gen.go) file with the updated SHA and includes it in the PR. - + > This PR was automatically created by workflow run [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" \ --base ${{ github.event.repository.default_branch }} \ --head ${{ steps.create-branch.outputs.branch }} From ffaa792332ff68c3395bcc8b4e7e6c7b9d2fbc9b Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 17:18:19 +0200 Subject: [PATCH 37/45] Revert "chore: update github-linguist SHA to e535c9adf5306132e9df0b75ffe1ce2679873fe8" --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index e06db7dd..8e895014 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index 398bf0f2..b8a4f419 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml package filetype From c3b564f17ee3fcb8e35ea1bf6822b4f42dfac4fd Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 17:21:22 +0200 Subject: [PATCH 38/45] chore: enhance PR check to prevent duplicates for Linguist SHA updates --- .github/workflows/linguist.yml | 35 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index cc2a78a3..f4fcb591 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -33,6 +33,22 @@ jobs: [[ ! "$SHA" =~ ^[0-9a-f]{40}$ ]] && { echo "Invalid SHA format"; exit 1; } echo "sha=$SHA" >> "$GITHUB_OUTPUT" + - name: Check existing PR + id: pr-check + if: steps.update-sha.outputs.sha_updated == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + SHA_EXISTS=$(gh pr list \ + --state open \ + --search "repo:${{ github.repository }} is:pr \"update github-linguist SHA to ${{ steps.fetch-sha.outputs.sha }}\"" \ + --json number \ + --jq 'length') + + if [[ "$SHA_EXISTS" != "0" ]]; then + echo "Skipping PR creation - existing PR with same SHA found" + exit 0 + fi - name: Update pinned SHA in internal/generate/knownfiles/main.go id: update-sha @@ -84,25 +100,8 @@ jobs: git push --set-upstream origin "$BRANCH" echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" - - name: Check existing PR - id: pr-check - if: steps.update-sha.outputs.sha_updated == 'true' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - EXISTS=$(gh pr list \ - --head "${{ steps.create-branch.outputs.branch }}" \ - --json number \ - --jq 'length') - - if [[ "$EXISTS" != "0" ]]; then - echo "skip=true" >> "$GITHUB_OUTPUT" - else - echo "skip=false" >> "$GITHUB_OUTPUT" - fi - - name: Create pull request - if: steps.update-sha.outputs.sha_updated == 'true' && steps.pr-check.outputs.skip != 'true' + if: steps.update-sha.outputs.sha_updated == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From 88ee65358f59c278b0ee78e7d2e8b23913bbb4bf Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 13 May 2026 15:24:51 +0000 Subject: [PATCH 39/45] chore: update github-linguist SHA --- internal/generate/knownfiles/main.go | 2 +- pkg/filetype/known_files_gen.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/generate/knownfiles/main.go b/internal/generate/knownfiles/main.go index 8e895014..e06db7dd 100644 --- a/internal/generate/knownfiles/main.go +++ b/internal/generate/knownfiles/main.go @@ -25,7 +25,7 @@ import ( ) const ( - linguistSHA = "cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret + linguistSHA = "e535c9adf5306132e9df0b75ffe1ce2679873fe8" // DevSkim: ignore DS173237 - this is a commit SHA, not a secret linguistURL = "https://raw.githubusercontent.com/github-linguist/linguist/" + linguistSHA + "/lib/linguist/languages.yml" outputFile = "known_files_gen.go" ) diff --git a/pkg/filetype/known_files_gen.go b/pkg/filetype/known_files_gen.go index b8a4f419..398bf0f2 100644 --- a/pkg/filetype/known_files_gen.go +++ b/pkg/filetype/known_files_gen.go @@ -1,5 +1,5 @@ // Code generated by go generate; DO NOT EDIT. -// Source: https://raw.githubusercontent.com/github-linguist/linguist/cb756ae9b3242a3a5fe2a5934dcfd8c518cf09d5/lib/linguist/languages.yml +// Source: https://raw.githubusercontent.com/github-linguist/linguist/e535c9adf5306132e9df0b75ffe1ce2679873fe8/lib/linguist/languages.yml package filetype From 41d71e5ca79004750078b63d7a014e9bc0a77ff6 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 17:39:53 +0200 Subject: [PATCH 40/45] chore: refine PR check to use consistent search format for existing SHA updates --- .github/workflows/linguist.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index f4fcb591..54f696f4 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -41,11 +41,12 @@ jobs: run: | SHA_EXISTS=$(gh pr list \ --state open \ - --search "repo:${{ github.repository }} is:pr \"update github-linguist SHA to ${{ steps.fetch-sha.outputs.sha }}\"" \ + --search 'in:title "chore: update github-linguist SHA to ${{ steps.fetch-sha.outputs.sha }}"' \ --json number \ - --jq 'length') + --jq 'length' \ + --repo "${{ github.repository }}") - if [[ "$SHA_EXISTS" != "0" ]]; then + if [[ "$SHA_EXISTS" != "0" ]]; then echo "Skipping PR creation - existing PR with same SHA found" exit 0 fi From 153fb52f182788e929e4b346efac9499e014d851 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 17:41:14 +0200 Subject: [PATCH 41/45] chore: remove unnecessary condition for PR check in Linguist workflow --- .github/workflows/linguist.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 54f696f4..1f5b69cb 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -34,8 +34,6 @@ jobs: echo "sha=$SHA" >> "$GITHUB_OUTPUT" - name: Check existing PR - id: pr-check - if: steps.update-sha.outputs.sha_updated == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From 7df921a6a55832daa509eb4fa464e51327d9dd62 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 17:49:39 +0200 Subject: [PATCH 42/45] chore: fix search format for existing PR check in Linguist workflow --- .github/workflows/linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 1f5b69cb..6382a8a4 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -39,7 +39,7 @@ jobs: run: | SHA_EXISTS=$(gh pr list \ --state open \ - --search 'in:title "chore: update github-linguist SHA to ${{ steps.fetch-sha.outputs.sha }}"' \ + --search "in:title \"chore: update github-linguist SHA to ${{ steps.fetch-sha.outputs.sha }}\"" \ --json number \ --jq 'length' \ --repo "${{ github.repository }}") From ac5efe25c250ecebdc796df93ef6c1f2986fe226 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 17:55:50 +0200 Subject: [PATCH 43/45] chore: fix formatting in existing PR check for Linguist SHA updates --- .github/workflows/linguist.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 6382a8a4..029f4d97 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -41,7 +41,7 @@ jobs: --state open \ --search "in:title \"chore: update github-linguist SHA to ${{ steps.fetch-sha.outputs.sha }}\"" \ --json number \ - --jq 'length' \ + --jq 'length' \ --repo "${{ github.repository }}") if [[ "$SHA_EXISTS" != "0" ]]; then From d03598e2f0bef10035dee8f249c12aab4a633e07 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 18:00:11 +0200 Subject: [PATCH 44/45] chore: enhance PR check to skip creation if existing SHA found --- .github/workflows/linguist.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 029f4d97..0d23f3be 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -45,12 +45,14 @@ jobs: --repo "${{ github.repository }}") if [[ "$SHA_EXISTS" != "0" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" echo "Skipping PR creation - existing PR with same SHA found" - exit 0 + else + echo "skip=false" >> "$GITHUB_OUTPUT" fi - - name: Update pinned SHA in internal/generate/knownfiles/main.go id: update-sha + if: steps.check-pr.outputs.skip != 'true' run: | FILEPATH=internal/generate/knownfiles/main.go SHA_REGEX='[0-9a-f]{40}' @@ -77,13 +79,13 @@ jobs: fi - name: Generate known_files_gen.go - if: steps.update-sha.outputs.sha_updated == 'true' + if: steps.update-sha.outputs.sha_updated == 'true' && steps.check-pr.outputs.skip != 'true' run: | go generate ./pkg/filetype/file_type.go git diff pkg/filetype/known_files_gen.go - name: Commit changes - if: steps.update-sha.outputs.sha_updated == 'true' + if: steps.update-sha.outputs.sha_updated == 'true' && steps.check-pr.outputs.skip != 'true' run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" @@ -92,7 +94,7 @@ jobs: - name: Create branch and push id: create-branch - if: steps.update-sha.outputs.sha_updated == 'true' + if: steps.update-sha.outputs.sha_updated == 'true' && steps.check-pr.outputs.skip != 'true' run: | BRANCH="autopr/${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}" git checkout -b "$BRANCH" @@ -100,7 +102,7 @@ jobs: echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" - name: Create pull request - if: steps.update-sha.outputs.sha_updated == 'true' + if: steps.update-sha.outputs.sha_updated == 'true' && steps.check-pr.outputs.skip != 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | From 41bf028906a2a43c8f60e787b12d64e3e8321779 Mon Sep 17 00:00:00 2001 From: Jakub Date: Wed, 13 May 2026 18:03:02 +0200 Subject: [PATCH 45/45] chore: improve SHA validation and ensure consistent output in PR check --- .github/workflows/linguist.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/linguist.yml b/.github/workflows/linguist.yml index 0d23f3be..1c6d5f76 100644 --- a/.github/workflows/linguist.yml +++ b/.github/workflows/linguist.yml @@ -33,7 +33,9 @@ jobs: [[ ! "$SHA" =~ ^[0-9a-f]{40}$ ]] && { echo "Invalid SHA format"; exit 1; } echo "sha=$SHA" >> "$GITHUB_OUTPUT" + - name: Check existing PR + id: check-pr env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -50,6 +52,7 @@ jobs: else echo "skip=false" >> "$GITHUB_OUTPUT" fi + - name: Update pinned SHA in internal/generate/knownfiles/main.go id: update-sha if: steps.check-pr.outputs.skip != 'true'