-
Notifications
You must be signed in to change notification settings - Fork 0
dev #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
dev #14
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d2b7d37
ci: added GHA workflows
jamesjohnsdev 153e150
ci: dependabot
jamesjohnsdev 2ae962d
chore: add codeowners
jamesjohnsdev 88f81da
feat: added command
jamesjohnsdev f6233a9
doc: updated readme
jamesjohnsdev 84ce84d
feat: added `complete` command
jamesjohnsdev bda3718
feat: enabled creation direct passthrough to editor
jamesjohnsdev bd486a1
refactor: rename complete => close to match GH terminology
jamesjohnsdev a7c1203
feat: improved display for issue list
jamesjohnsdev 722a30b
fix: correct parsing of local issue numbers
jamesjohnsdev 1b9e74c
test: test suites added
jamesjohnsdev 2530941
test: added fuzz testing
jamesjohnsdev 7d1b73b
chore: cleanup old references to `issue` command rather than `issues`
jamesjohnsdev 7d9de9b
feat: delete command
jamesjohnsdev 440fd43
ci: fix main CI workflow
jamesjohnsdev abd6765
chore: formating and unchecked errs
jamesjohnsdev c2e3b8a
fix(root): rename root command name to "issues"
jamesjohnsdev 5328d2f
ci: point dependabot at root go module
jamesjohnsdev 257228c
fix(util): reject partial numeric ids such as "123abc"
jamesjohnsdev 5869e48
fix(create): three editor mode correctness bugs
jamesjohnsdev 5f90b97
fix(view): split editor string to support flags
jamesjohnsdev 32b811e
test(fuzz): skip round-trip body check for leading-newline inputs
jamesjohnsdev 5f3127e
chore: mod tidy
jamesjohnsdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| * @jamesjohnsdev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "gomod" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "saturday" | ||
| time: "03:00" | ||
| timezone: "UTC" | ||
| cooldown: | ||
| default-days: 7 | ||
| groups: | ||
| go-dependencies: | ||
| patterns: | ||
| - "*" | ||
| open-pull-requests-limit: 3 | ||
|
|
||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "saturday" | ||
| time: "03:00" | ||
| timezone: "UTC" | ||
| cooldown: | ||
| default-days: 7 | ||
| groups: | ||
| github-actions: | ||
| patterns: | ||
| - "*" | ||
| open-pull-requests-limit: 3 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: CI | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 5 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | ||
| with: | ||
| go-version-file: go.mod | ||
| cache-dependency-path: go.sum | ||
|
|
||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@82606bf257cbaff209d206a39f5134f0cfbfd2ee # v9 | ||
|
|
||
| - name: govulncheck | ||
| run: go run golang.org/x/vuln/cmd/govulncheck@v1.3.0 ./... | ||
|
|
||
| - name: Go Tidy | ||
| run: go mod tidy && git diff --exit-code | ||
|
|
||
| - name: Go Mod Verify | ||
| run: go mod verify | ||
|
|
||
| - name: Build | ||
| run: go build -o /dev/null ./... | ||
|
|
||
| - name: Test | ||
| run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./... | ||
|
|
||
| - name: Coverage summary | ||
| run: go tool cover -func=coverage.txt >> "$GITHUB_STEP_SUMMARY" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Go fuzz tests | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 3 * * 0" # Every Sunday at 03:00 UTC | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| discover: | ||
| name: Discover fuzz tests | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Find all fuzz tests | ||
| id: set-matrix | ||
| run: | | ||
| matrix=$( | ||
| { grep -rl "^func Fuzz" transpiler --include="*_test.go" || true; } | sort | while read -r file; do | ||
| pkg_dir=$(dirname "$file") | ||
| go_pkg="./${pkg_dir#transpiler}" | ||
| grep "^func Fuzz" "$file" | sed 's/func \(Fuzz[^(]*\).*/\1/' | while read -r fn; do | ||
| printf '{"function":"%s","go_package":"%s","corpus_path":"%s/testdata/fuzz"}\n' \ | ||
| "$fn" "$go_pkg" "$pkg_dir" | ||
| done | ||
| done | jq -sc '.' | ||
| ) | ||
| echo "matrix=$matrix" >> "$GITHUB_OUTPUT" | ||
|
|
||
| fuzz: | ||
| name: ${{ matrix.function }} | ||
| needs: discover | ||
| if: needs.discover.outputs.matrix != '[]' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: ${{ fromJson(needs.discover.outputs.matrix) }} | ||
| defaults: | ||
| run: | ||
| working-directory: transpiler | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version-file: transpiler/go.mod | ||
| cache: false | ||
| - name: Run ${{ matrix.function }} | ||
| env: | ||
| GO_PKG: ${{ matrix.go_package }} | ||
| FUZZ_FN: ${{ matrix.function }} | ||
| run: go test "$GO_PKG" "-fuzz=$FUZZ_FN" -fuzztime=5m | ||
| - name: Upload fuzz failure seed corpus | ||
| if: failure() | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: fuzz-corpus-${{ matrix.function }} | ||
| path: ${{ matrix.corpus_path }}/${{ matrix.function }} | ||
| - name: Output troubleshooting message | ||
| if: failure() | ||
| env: | ||
| FUZZ_FN: ${{ matrix.function }} | ||
| RUN_ID: ${{ github.run_id }} | ||
| SHA: ${{ github.sha }} | ||
| shell: bash | ||
| run: | | ||
| echo -e "Fuzz test $FUZZ_FN failed on commit $SHA. To troubleshoot locally, use the GitHub CLI to download the seed corpus with\n\ngh run download $RUN_ID -n fuzz-corpus-$FUZZ_FN\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| name: Semgrep | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| schedule: | ||
| - cron: "0 4 * * 0" # Every Sunday at 04:00 UTC | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| semgrep: | ||
| name: Semgrep scan | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Run Semgrep | ||
| run: pipx run semgrep scan --config=p/golang --config=p/secrets --error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Workflow Lint | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - ".github/workflows/**" | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - ".github/workflows/**" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| zizmor: | ||
| name: zizmor | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| actions: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Run zizmor | ||
| uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6 | ||
| with: | ||
| advanced-security: false | ||
| inputs: .github/workflows/ | ||
|
|
||
| actionlint: | ||
| name: actionlint | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - uses: raven-actions/actionlint@205b530c5d9fa8f44ae9ed59f341a0db994aa6f8 # v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
| "path/filepath" | ||
|
|
||
| "github.com/fatih/color" | ||
| "github.com/jamesjohnsdev/issues/internal/issue" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| var closeCmd = &cobra.Command{ | ||
| Use: "close <number>", | ||
| Short: "Mark an issue as closed", | ||
| Args: cobra.ExactArgs(1), | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| root, err := issuesRoot() | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| iss, err := findLocalByID(root, args[0]) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if iss.State == "closed" { | ||
| fmt.Printf("Issue %s is already closed.\n", args[0]) | ||
| return nil | ||
| } | ||
|
|
||
| iss.State = "closed" | ||
|
|
||
| newPath := filepath.Join(closedDir(root), filepath.Base(iss.Path)) | ||
| if err := os.MkdirAll(closedDir(root), 0755); err != nil { | ||
| return err | ||
| } | ||
| if err := issue.Write(newPath, iss); err != nil { | ||
| return err | ||
| } | ||
| if err := os.Remove(iss.Path); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| fmt.Printf("%s %s: %s\n", color.GreenString("Closed"), args[0], iss.Title) | ||
| return nil | ||
| }, | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.