Skip to content

Commit

Permalink
Configure throttle plugin and allow setting token on the action to in…
Browse files Browse the repository at this point in the history
…crease rate limit
  • Loading branch information
imranismail committed May 12, 2021
1 parent b67a0e7 commit 60d5757
Show file tree
Hide file tree
Showing 14 changed files with 29,801 additions and 21,930 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
lib/
node_modules/
node_modules/
jest.config.js
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nodejs 14.12.0
nodejs 15.14.0
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,33 @@

Install any kustomize version as a step in your workflow

## Options

Every argument is optional.

| Input | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------ |
| `github-token` | PAT (Personal Access Token) for authorizing the repository.<br>_Defaults to **\${{ github.token }}**_. |
| `kustomize-version` | Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0.<br>_Defaults to **\***_. |

## Usage

```yaml
on:
push:
branches:
- master
- master

jobs:
create-deployment-branch:
runs-on: ubuntu-latest
needs:
- publish-image
- publish-image
steps:
- uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.1.0"
- run: git clone https://${REPO_TOKEN}@github.com/org/deployment.git .
env:
REPO_TOKEN: ${{secrets.REPO_TOKEN}}
- run: git branch deployment/app/${GITHUB_REF/refs\/heads\//}
- run: kustomize edit set image app:${GITHUB_SHA}
- run: git add .
- run: git commit -m "Set `app` image tag to `${GITHUB_SHA}`"
- run: git push origin deployment/app/${GITHUB_REF/refs\/heads\//}
- uses: imranismail/setup-kustomize@v1
- run: |
kustomize edit set image app:${GITHUB_SHA}
git add .
git commit -m "Set `app` image tag to `${GITHUB_SHA}`"
git push
```
18 changes: 4 additions & 14 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ describe('installer tests', () => {
})

it('Acquires the max satisfying version range', async () => {
await installer.getKustomize('~> 3.0')
const kustomizeDir = path.join(toolDir, 'kustomize', '~> 3.0', os.arch())
await installer.getKustomize('*')
const kustomizeDir = path.join(toolDir, 'kustomize', '*', os.arch())
expect(fs.existsSync(`${kustomizeDir}.complete`)).toBe(true)

if (IS_WINDOWS) {
Expand Down Expand Up @@ -95,12 +95,7 @@ describe('installer tests', () => {
})

it('Uses version of kustomize installed in cache', async () => {
const kustomizeDir: string = path.join(
toolDir,
'kustomize',
'3.2.0',
os.arch()
)
const kustomizeDir = path.join(toolDir, 'kustomize', '3.2.0', os.arch())

await io.mkdirP(kustomizeDir)

Expand All @@ -112,12 +107,7 @@ describe('installer tests', () => {
})

it('Resolves semantic versions of kustomize installed in cache', async () => {
const kustomizeDir: string = path.join(
toolDir,
'kustomize',
'3.0.0',
os.arch()
)
const kustomizeDir = path.join(toolDir, 'kustomize', '3.0.0', os.arch())

await io.mkdirP(kustomizeDir)

Expand Down
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ branding:
inputs:
kustomize-version:
description: 'Version Spec of the version to use. Examples: 10.x, 10.15.1, >=10.15.0'
default: '3.x'
required: false
default: '*'
github-token:
description: 'Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`.'
required: false
default: ${{ github.token }}
runs:
using: 'node12'
main: 'dist/index.js'
main: 'dist/index.js'
Loading

0 comments on commit 60d5757

Please sign in to comment.