-
Notifications
You must be signed in to change notification settings - Fork 1
feat(DEV-1582): New fetch-github-token-js action #8
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
base: main
Are you sure you want to change the base?
Changes from 21 commits
de2338e
83e837a
035f375
192e6ff
cf0bfb8
3246d65
ed93ec3
e5e29bb
7807607
667675a
ea4733b
c1056e0
e5210b2
39b11be
037bf17
eb34f01
1d29950
3c9072f
72e4b17
16749d4
b5cd626
6186847
56932bf
7658798
547b732
1e2b853
16d6bdb
88e8032
ff3085f
a9fac27
114c799
eb41789
b9fecf6
6a1085b
fdab423
b46cf9f
b0694b8
c3679c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Run Unit Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '24' | ||
| - name: Install dependencies | ||
| run: npm install | ||
| - name: Run tests | ||
| run: npm test |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # <!--name-->Get Ephemeral GitHub Token from CI Vault<!--/name--> | ||
|
||
|
|
||
| [](https://github.com/search?q=elastic%2Foblt-actions%2Ffetch-github-token-js+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code) | ||
| [](https://github.com/elastic/ci-gh-actions/actions/workflows/fetch-github-token-js.yml) | ||
|
|
||
| <!--description--> | ||
| Fetch an ephemeral GitHub token from Vault using OIDC authentication | ||
| <!--/description--> | ||
| ## Inputs | ||
| <!--inputs--> | ||
| | Name | Description | Required | Default | | ||
| |---------------------|------------------------------------------------------------------------------------------------------------------------------------|----------|---------| | ||
| | `vault-instance` | Vault instance to connect to (ci-prod or ci-dev) | `true` | ` ` | | ||
| | `vault-role` | Vault role to assume for GitHub token retrieval. If not provided, it will be generated based on the workflow ref of the GH Action. | `false` | ` ` | | ||
| | `skip-token-revoke` | If true, skip revoking the GitHub token on exit | `false` | `true` | | ||
| <!--/inputs--> | ||
| ## Outputs | ||
| <!--outputs--> | ||
| | Name | Description | | ||
| |---------|---------------------------------------| | ||
| | `token` | GitHub App installation access token. | | ||
| <!--/outputs--> | ||
| ## Usage | ||
| <!--usage action="elastic/ci-gh-actions**" version="env:VERSION"--> | ||
| ```yaml | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - uses: elastic/ci-gh-actions/fetch-github-token-js@v1 | ||
| id: fetch-token | ||
| with: | ||
| vault-instance: "ci-prod" | ||
|
|
||
| - uses: .. | ||
| with: | ||
| github-token: ${{ steps.fetch-token.outputs.token }} | ||
| ``` | ||
| <!--/usage--> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| name: Get Ephemeral GitHub Token from CI Vault | ||
| description: 'Fetch an ephemeral GitHub token from Vault using OIDC authentication' | ||
| inputs: | ||
| vault-instance: | ||
| description: 'Vault instance to connect to (ci-prod or ci-dev)' | ||
| required: true | ||
| vault-role: | ||
| description: 'Vault role to assume for GitHub token retrieval. If not provided, it will be generated based on the workflow ref of the GH Action.' | ||
| required: false | ||
| default: '' | ||
| skip-token-revoke: | ||
esenmarti marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| description: 'If true, skip revoking the GitHub token on exit' | ||
| required: false | ||
| default: 'true' | ||
chrisnavar marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| outputs: | ||
| token: | ||
| description: GitHub App installation access token. | ||
| runs: | ||
| using: 'node24' | ||
| main: 'dist/main.js' | ||
| post: 'dist/revoke.js' | ||
Uh oh!
There was an error while loading. Please reload this page.