Skip to content

Commit

Permalink
refactor: ♻️ use date as release name, optimize a minor piece of code…
Browse files Browse the repository at this point in the history
… in OSS
  • Loading branch information
bastiandoetsch committed Feb 4, 2022
1 parent 466a0f5 commit 79a87af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: set env
run: echo "NOW=v$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV

- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17


- name: Build
run: |
mkdir -p output
Expand Down Expand Up @@ -68,8 +72,8 @@ jobs:
if: ${{ !env.ACT }}
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
automatic_release_tag: "${{ env.NOW }}"
prerelease: false
title: "${{ github.sha }}"
title: "${{ env.NOW }}"
files: |
output/*
16 changes: 8 additions & 8 deletions oss/oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,16 @@ func findRange(issue ossIssue, doc sglsp.TextDocumentItem) sglsp.Range {
lines := strings.Split(
strings.ReplaceAll(doc.Text, "\r", ""),
"\n")
var packageName string
if len(issue.From) > 1 {
split := strings.Split(issue.From[1], "@")
packageName = fmt.Sprintf("\"%s\": \"", split[0])
} else {
packageName = fmt.Sprintf("\"%s\": \"", issue.Name)
}
var lineStart, lineEnd, characterStart, characterEnd int
for i := 0; i < len(lines); i++ {
line := lines[i]
var packageName string
if len(issue.From) > 1 {
split := strings.Split(issue.From[1], "@")
packageName = fmt.Sprintf("\"%s\": \"", split[0])
} else {
packageName = fmt.Sprintf("\"%s\": \"", issue.Name)
}
if issue.PackageManager == "npm" {
if strings.HasPrefix(
strings.TrimSpace(strings.ReplaceAll(line, "^", "")), packageName) {
Expand All @@ -157,7 +157,7 @@ func findRange(issue ossIssue, doc sglsp.TextDocumentItem) sglsp.Range {
break
} else if issue.PackageManager == "maven" {
// todo respect from
packageName = strings.Split(strings.ReplaceAll(packageName, "\"", ""), ":")[0]
packageName = strings.Split(strings.ReplaceAll(packageName, "\"", ""), ":")[1]
if filepath.Base(string(doc.URI)) == "pom.xml" &&
strings.Contains(
line, fmt.Sprintf("<artifactId>%s</artifactId>", packageName),
Expand Down

0 comments on commit 79a87af

Please sign in to comment.