Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c55cd81
Update version to 2.0.2
mrfelton Dec 29, 2024
46aecd4
Reference package from mrfelton repo
mrfelton Dec 29, 2024
d218703
chore(deps): bump golang.org/x/oauth2 from 0.24.0 to 0.25.0 (#141)
dependabot[bot] Jan 6, 2025
545911a
bump go-github to current v68 (#145)
monsagri Jan 15, 2025
c49a2f6
fix changelog text (#146)
monsagri Jan 15, 2025
587300f
Ffeldberg/rel 4888/support enterprise instances (#147)
monsagri Jan 16, 2025
30f4c4a
prepare release (#148)
monsagri Jan 16, 2025
a15eea5
chore(deps): bump github.com/go-git/go-git/v5 from 5.12.0 to 5.13.0 (…
dependabot[bot] May 13, 2025
7fa7dbd
chore(deps): bump actions/setup-node from 4.1.0 to 4.4.0 (#161)
dependabot[bot] May 13, 2025
5aeec75
chore(deps): bump golang.org/x/oauth2 from 0.25.0 to 0.30.0 (#164)
dependabot[bot] May 13, 2025
3f98ad9
chore(deps): bump actions/setup-python from 5.3.0 to 5.6.0 (#163)
dependabot[bot] May 13, 2025
ef68470
chore(deps): bump golang.org/x/crypto from 0.31.0 to 0.35.0 (#162)
dependabot[bot] May 13, 2025
962b0be
chore(deps): bump actions/setup-go from 5.2.0 to 5.5.0 (#165)
dependabot[bot] May 13, 2025
6ac887a
bump go to 1.24 (#166)
blaqbern May 13, 2025
9e31145
update code owners (#170)
blaqbern May 14, 2025
b9e6098
bump viper incrementally (#168)
blaqbern May 14, 2025
f03abba
bump viper to latest (#171)
blaqbern May 14, 2025
564fe40
[REL-5292] Cblackburn/rel 5292/handle large diffs (#172)
blaqbern Jun 9, 2025
e8ebad1
chore(deps): bump actions/checkout from 4.2.2 to 4.3.0 (#175)
dependabot[bot] Aug 11, 2025
de9a4c7
chore(deps): bump actions/checkout from 4.3.0 to 5.0.0 (#176)
dependabot[bot] Aug 18, 2025
061d7a1
chore(deps): bump github.com/launchdarkly/ld-find-code-refs/v2 from 2…
dependabot[bot] Aug 19, 2025
06e2b29
chore(deps): bump github.com/go-viper/mapstructure/v2 from 2.2.1 to 2…
dependabot[bot] Aug 19, 2025
85e70d7
chore(deps): bump github.com/go-viper/mapstructure/v2 from 2.3.0 to 2…
dependabot[bot] Aug 21, 2025
e84aaa9
chore(deps): bump github.com/stretchr/testify from 1.10.0 to 1.11.0 (…
dependabot[bot] Aug 26, 2025
fb8c15d
chore(deps): bump golang.org/x/oauth2 from 0.30.0 to 0.31.0 (#182)
dependabot[bot] Sep 8, 2025
b46b75f
chore(deps): bump github.com/stretchr/testify from 1.11.0 to 1.11.1 (…
dependabot[bot] Sep 8, 2025
4603613
chore(deps): bump actions/setup-python from 5.6.0 to 6.0.0 (#184)
dependabot[bot] Sep 8, 2025
74d7168
chore(deps): bump actions/setup-node from 4.4.0 to 5.0.0 (#185)
dependabot[bot] Sep 8, 2025
0827acf
chore(deps): bump actions/setup-go from 5.5.0 to 6.0.0 (#186)
dependabot[bot] Sep 8, 2025
8cbd1e5
docs(readme): add note in README about creating the "ld-flags" label …
brianvans Oct 7, 2025
7478c42
chore(deps): bump golang.org/x/oauth2 from 0.31.0 to 0.32.0 (#189)
dependabot[bot] Oct 13, 2025
1abb697
chore(deps): bump golang.org/x/oauth2 from 0.32.0 to 0.33.0 (#191)
dependabot[bot] Nov 10, 2025
7d5c6b4
[REL-10104] Update CODEOWNERS (#192)
ldhenry Nov 11, 2025
4b6166c
chore(deps): bump golang.org/x/crypto from 0.41.0 to 0.45.0 (#193)
dependabot[bot] Nov 25, 2025
0b99f04
chore(deps): bump actions/setup-python from 6.0.0 to 6.1.0 (#196)
dependabot[bot] Dec 1, 2025
7366fe0
Merge remote-tracking branch 'ld/main' into container-prebuilt
mrfelton Feb 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 13 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8

- name: Set up Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: '18.x'

- name: Install datadog-ci
run: npm install -g @datadog/datadog-ci

- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
with:
python-version: '3.x'

- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: go.mod

- name: Install pre-commit
run: |
python -m pip install --upgrade pip
Expand All @@ -33,11 +38,6 @@ jobs:
- name: Run pre-commit hooks
run: pre-commit run --all-files

- name: Set up Go
uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a
with:
go-version-file: go.mod

- name: Install dependencies
run: go mod tidy

Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Setup Docker BuildX
id: setup-buildx
uses: docker/setup-buildx-action@v3
Expand All @@ -103,7 +103,7 @@ jobs:
# Backup original file
cp action.yml action.yml.bak
# Replace image path for local testing
sed -i 's|docker://ghcr.io/ln-zap/find-code-references-in-pull-request:latest|docker://localhost:5001/actions/find-code-references-in-pull-request:latest|' action.yml
sed -i 's|docker://ghcr.io/mrfelton/find-code-references-in-pull-request:latest|docker://localhost:5001/actions/find-code-references-in-pull-request:latest|' action.yml
- name: Find LaunchDarkly feature flags in diff
uses: ./ # Uses an action in the root directory
id: find-flags
Expand Down Expand Up @@ -148,10 +148,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8

- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
with:
python-version: '3.x'

Expand All @@ -161,7 +161,7 @@ jobs:
pip install pre-commit

- name: Set up Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444
with:
node-version: '18.8.0'

Expand Down
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ repos:
language: golang
pass_filenames: false

- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.3.3
hooks:
- id: go-unit-tests
# Run as part of GHA workflow
# - repo: https://github.com/dnephin/pre-commit-golang
# rev: v0.3.3
# hooks:
# - id: go-unit-tests

- repo: local
hooks:
Expand Down
1 change: 1 addition & 0 deletions .secrets.example.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Save as .secrets for testing with nektos/act

LD_ACCESS_TOKEN= # LaunchDarkly access token
LD_ACCESS_TOKEN_WRITER= # LaunchDarkly access token (both are used for local runs with act)
GITHUB_TOKEN= # GitHub PAT with repo access
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.0
v2.0.2
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@

### Fixed

## 2.1.0

### Added

- Add support for enterprise hosted github instances [More info](https://github.com/launchdarkly/find-code-references-in-pull-request/issues/102)

### Changed

### Fixed

- Potential null pointer error when creating flag links

## 2.0.2

### Changed

- Update dependencies

## 2.0.1

### Changed
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These owners will be the default owners for everything in the repo.

* @launchdarkly/team-automation
* @launchdarkly/team-fm-next
3 changes: 2 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
## Testing locally

Use [nektos/act](https://github.com/nektos/act) to run actions locally.
NB: You'll want to use the `large` runner in order to have access to all commands needed for testing.

```
act
act -e testdata/act/pull-request.json
```

_Read more: [Example commands](https://github.com/nektos/act#example-commands)_
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ jobs:
access-token: ${{ secrets.LD_ACCESS_TOKEN }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

# Add or remove labels on PRs if any flags have changed
# Add or remove labels on PRs if any flags have changed.
# Note: This example requires the "ld-flags" label to have been created in the repository first:
# https://docs.github.com/en/issues/using-labels-and-milestones-to-track-work/managing-labels#creating-a-label
- name: Add label
if: steps.find-flags.outputs.any-changed == 'true'
run: gh pr edit $PR_NUMBER --add-label ld-flags
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: 'LaunchDarkly Code References in Pull Request'
description: 'Find references to feature flags in your pull request'
runs:
using: 'docker'
image: 'docker://ghcr.io/ln-zap/find-code-references-in-pull-request:latest'
image: 'docker://ghcr.io/mrfelton/find-code-references-in-pull-request:latest'
env:
LD_PROJ_KEY: ${{ inputs.project-key }}
LD_ACCESS_TOKEN: ${{ inputs.access-token }}
Expand Down
3 changes: 2 additions & 1 deletion comments/comments.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import (

sprig "github.com/Masterminds/sprig/v3"

"github.com/google/go-github/github"
"github.com/google/go-github/v68/github"

ldapi "github.com/launchdarkly/api-client-go/v15"
lcr "github.com/launchdarkly/find-code-references-in-pull-request/config"
gha "github.com/launchdarkly/find-code-references-in-pull-request/internal/github_actions"
Expand Down
22 changes: 18 additions & 4 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"strconv"
"strings"

"github.com/google/go-github/github"
"github.com/google/go-github/v68/github"

"golang.org/x/oauth2"

gha "github.com/launchdarkly/find-code-references-in-pull-request/internal/github_actions"
Expand Down Expand Up @@ -97,14 +98,27 @@ func ValidateInputandParse(ctx context.Context) (*Config, error) {
config.CreateFlagLinks = createFlagLinks
}

config.GHClient = getGithubClient(ctx)
client, err := getGithubClient(ctx)
if err != nil {
return nil, err
}
config.GHClient = client

return &config, nil
}

func getGithubClient(ctx context.Context) *github.Client {
func getGithubClient(ctx context.Context) (*github.Client, error) {
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
)
tc := oauth2.NewClient(ctx, ts)
return github.NewClient(tc)
gc := github.NewClient(tc)

host := os.Getenv("GITHUB_SERVER_URL")
if host != "https://github.com" && host != "" {
gha.Log("Using GitHub Enterprise host. baseUrl: %s, uploadUrl: %s", host+"/api/v3/", host+"/api/uploads/")
return gc.WithEnterpriseURLs(host+"/api/v3/", host+"/api/uploads/")
}

return gc, nil
}
1 change: 1 addition & 0 deletions errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ import "errors"

var (
UnauthorizedError = errors.New("`repo-token` lacks required permissions")
NoGitError = errors.New("`git` not installed")
)
63 changes: 33 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,75 +1,78 @@
module github.com/launchdarkly/find-code-references-in-pull-request

go 1.22
toolchain go1.22.5
go 1.24.0

require (
github.com/Masterminds/sprig/v3 v3.3.0
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00
github.com/sourcegraph/go-diff v0.6.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
golang.org/x/oauth2 v0.24.0
github.com/spf13/viper v1.20.1
github.com/stretchr/testify v1.11.1
golang.org/x/oauth2 v0.33.0
)

require (
github.com/google/go-github/v68 v68.0.0
github.com/jstemmer/go-junit-report/v2 v2.1.0
github.com/kyoh86/richgo v0.3.12
github.com/launchdarkly/ld-find-code-refs/v2 v2.13.0
github.com/launchdarkly/ld-find-code-refs/v2 v2.14.0
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/launchdarkly/api-client-go/v17 v17.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/olekukonko/errors v0.0.0-20250405072817-4e6d85265da6 // indirect
github.com/olekukonko/ll v0.0.8 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/tetratelabs/wazero v1.9.0 // indirect
github.com/wasilibs/go-re2 v1.10.0 // indirect
github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/tools/godoc v0.1.0-deprecated // indirect
)

require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.7.1 // indirect
github.com/bmatcuk/doublestar/v4 v4.9.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-git/go-git/v5 v5.12.0 // indirect
github.com/fsnotify/fsnotify v1.8.0 // indirect
github.com/go-git/go-git/v5 v5.16.2 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/kyoh86/xdg v1.2.0 // indirect
github.com/launchdarkly/api-client-go/v15 v15.1.0
github.com/launchdarkly/json-patch v0.0.0-20180720210516-dd68d883319f // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/olekukonko/tablewriter v1.0.8 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/petar-dambovaliev/aho-corasick v0.0.0-20211021192214-5ab2d9280aa9 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pjbgf/sha1cd v0.3.2 // indirect
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/afero v1.12.0 // indirect
github.com/spf13/cast v1.7.1 // indirect
github.com/spf13/pflag v1.0.7 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/wacul/ptr v1.0.0 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/tools v0.28.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/text v0.31.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading