-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
New issue?
- I have reviewed the Known Issues and confirm this is not a known issue.
TL;DR
I'm getting error panic: runtime error: index out of range [40] with length 40
when running ratchet update mega-linter.yml
Expected behavior
It should update the GitHub Action file or give me the "understandable" error.
Observed behavior
No response
Version
0.9.1
On what operating system are you using ratchet?
Mac OS
CI/CD workflow file
---
name: mega-linter
on:
workflow_dispatch:
push:
branches-ignore:
- main
permissions: read-all
jobs:
mega-linter:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Restore lychee cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Extract commands from markdown files
run: |
set -euxo pipefail
echo '#!/usr/bin/env bash' > README.sh
find . -name '*.md' -print0 | while IFS= read -r -d '' FILE; do
# Extract: ...
sed -n "/^\`\`\`\(bash\|shell\)$/,/^\`\`\`$/p" "${FILE}" | sed '/^```*/d' >> README.sh
# Extract: ```bash ... ```
sed -n "/^ \`\`\`\(bash\|shell\)$/,/^ \`\`\`$/p" "${FILE}" | sed '/^ ```*/d; s/^ //' >> README.sh
done
ls -la README.sh
chmod a+x README.sh
- name: 💡 MegaLinter
uses: oxsecurity/megalinter@a7a0163b6c8ff7474a283d99a706e27483ddd80f # v7.10.0
env:
GITHUB_COMMENT_REPORTER: false
# Disabled due to error: [GitHub Status Reporter] Error posting Status for REPOSITORY with ...: 403
GITHUB_STATUS_REPORTER: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Relevant log output
❯ ratchet update mega-linter.yml
panic: runtime error: index out of range [40] with length 40
goroutine 1 [running]:
github.com/sethvargo/ratchet/command.fixIndentation(0x1400011e0f0)
github.com/sethvargo/ratchet/command/command.go:180 +0x404
github.com/sethvargo/ratchet/command.loadYAMLFiles({0x104df0358, 0x14000200080}, {0x14000200050, 0x1, 0x3?}, 0x1)
github.com/sethvargo/ratchet/command/command.go:147 +0x1d4
github.com/sethvargo/ratchet/command.(*UpdateCommand).Run(0x14000198060, {0x104df30b0, 0x1400003b180}, {0x140000122c0, 0x1, 0x1})
github.com/sethvargo/ratchet/command/update.go:72 +0x144
github.com/sethvargo/ratchet/command.Run({0x104df30b0, 0x1400003b180}, {0x140000122b0?, 0x2?, 0x2?})
github.com/sethvargo/ratchet/command/command.go:58 +0x278
main.realMain(...)
github.com/sethvargo/ratchet/main.go:26
main.main()
github.com/sethvargo/ratchet/main.go:18 +0xc0
Additional information
Steps to reproduce the error:
$ cd /tmp/
$ wget https://raw.githubusercontent.com/ruzickap/my-git-projects/main/gh-repo-defaults/my-defaults/.github/workflows/mega-linter.yml
$ ratchet update mega-linter.yml
panic: runtime error: index out of range [40] with length 40
goroutine 1 [running]:
github.com/sethvargo/ratchet/command.fixIndentation(0x140001981e0)
github.com/sethvargo/ratchet/command/command.go:180 +0x404
github.com/sethvargo/ratchet/command.loadYAMLFiles({0x104970358, 0x14000110080}, {0x14000110050, 0x1, 0x3?}, 0x1)
github.com/sethvargo/ratchet/command/command.go:147 +0x1d4
github.com/sethvargo/ratchet/command.(*UpdateCommand).Run(0x14000198060, {0x1049730b0, 0x1400003b180}, {0x140000122c0, 0x1, 0x1})
github.com/sethvargo/ratchet/command/update.go:72 +0x144
github.com/sethvargo/ratchet/command.Run({0x1049730b0, 0x1400003b180}, {0x140000122b0?, 0x2?, 0x2?})
github.com/sethvargo/ratchet/command/command.go:58 +0x278
main.realMain(...)
github.com/sethvargo/ratchet/main.go:26
main.main()
github.com/sethvargo/ratchet/main.go:18 +0xc0
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working