Skip to content

Commit

Permalink
Make all code references options available as inputs (#5)
Browse files Browse the repository at this point in the history
* Bump ld-find-code-refs-github-action version

* don't include the example action in the build

* bump ld-find-code-refs-github-action to 1.4.0

* update readme

* make all options configurable with inputs
  • Loading branch information
Arnold Trakhtenberg committed Mar 19, 2020
1 parent c2c2f15 commit cdcd47d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 16 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ jobs:
name: LaunchDarkly Code References
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: LaunchDarkly Code References
uses: launchdarkly/find-code-references@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LD_ACCESS_TOKEN: ${{ secrets.LD_ACCESS_TOKEN }}
LD_PROJ_KEY: YOUR_PROJECT_KEY
uses: launchdarkly/find-code-references@v5
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
accessToken: ${{ secrets.LD_ACCESS_TOKEN }}
projKey: YOUR_PROJECT_KEY
```

We strongly recommend that you update the second `uses` attribute value to reference the latest tag in the [launchdarkly/find-code-references repository](https://github.com/launchdarkly/find-code-references). This will pin your workflow to a particular version of the `launchdarkly/find-code-references` action.

If you already have a `action.yml` file, copy and paste the above `launchDarklyCodeReferences` job declaration into the `jobs` section in your existing `action.yml` file. If you wish to verify that you've pasted the above correctly, you can go into the visual editor and ensure that there are no syntax errors. `LD_PROJ_KEY` refers to the key of the LaunchDarkly project associated with this repository.
If you already have a `action.yml` file, copy and paste the above `launchDarklyCodeReferences` job declaration into the `jobs` section in your existing `action.yml` file. If you wish to verify that you've pasted the above correctly, you can go into the visual editor and ensure that there are no syntax errors. `projKey` refers to the key of the LaunchDarkly project associated with this repository.

Commit this file under a new branch. Submit as a PR to your code reviewers to be merged into your master branch. You do not need to have this branch merged into the master for code references to appear in the LaunchDarkly UI for your flags; code references will appear for this newly created branch.

Expand Down
41 changes: 32 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,42 @@ branding:
icon: toggle-right
color: gray-dark
inputs:
ld-proj-key:
description: 'Key of the LaunchDarkly project associated with this repository'
default: 'YOUR_PROJECT_KEY'
projKey:
description: 'Key of the LaunchDarkly project associated with this repository.'
required: true
ld-access-token:
description: 'Token with write access to LaunchDarkly project'
accessToken:
description: 'Token with write access to LaunchDarkly project.'
required: true
github-token:
baseUri:
description: 'Set the base URL of the LaunchDarkly server for this configuration.'
default: 'https://app.launchdarkly.com'
contextLines:
description:
The number of context lines above and below a code reference for the job to send to LaunchDarkly. By default, the flag finder will not send any context lines to LaunchDarkly. If < 0, no source code will be sent to LaunchDarkly. If 0, only the lines containing flag references will be sent. If > 0, will send that number of context lines above and below the flag reference. A maximum of 5 context lines may be provided.
default: 2
debug:
description: Enables verbose debug logging.
default: false
delimiters:
description: Specifies additional delimiters used to match flag keys. Must be a non-control ASCII character. If more than one character is provided in `delimiters`, each character will be treated as a separate delimiter. Will only match flag keys with surrounded by any of the specified delimeters. This option may also be specified multiple times for multiple delimiters. By default, only flags delimited by single-quotes, double-quotes, and backticks will be matched.
exclude:
description:
A regular expression (PCRE) defining the files, file types, and directories which the job should exclude. Partial matches are allowed.
ignoreServiceErrors:
description: If enabled, the scanner will terminate with exit code 0 when the LaunchDarkly API is unreachable or returns an unexpected response.
default: false
githubToken:
description: 'Token to access your GitHub repository. This is only needed if the code has not yet been checkout out in a prior step.'
runs:
using: 'docker'
image: 'Dockerfile'
env:
LD_PROJ_KEY: ${{ inputs.ld-proj-key }}
LD_ACCESS_TOKEN: ${{ inputs.ld-access-token }}
GITHUB_TOKEN: ${{ inputs.github-token }}
LD_PROJ_KEY: ${{ inputs.projKey }}
LD_ACCESS_TOKEN: ${{ inputs.accessToken }}
LD_BASE_URI: ${{ inputs.baseUri }}
LD_CONTEXT_LINES: ${{ inputs.contextLines }}
LD_DEBUG: ${{ inputs.debug }}
LD_DELIMITERS: ${{ inputs.delimiters }}
LD_EXCLUDE: ${{ inputs.exclude }}
LD_IGNORE_SERVICE_ERRORS: ${{ inputs.ignoreServiceErrors }}
GITHUB_TOKEN: ${{ inputs.githubToken }}

0 comments on commit cdcd47d

Please sign in to comment.