Skip to content

AnchorFree/role-session-name-action

Repository files navigation

role-session-name-action

Get GitHub Action context and combine output based on organization,repository, and runId. Resulted string supposed to be used as role-session-name of aws-actions/configure-aws-credentials

Code in Main

Install the dependencies

$ npm install

Build the typescript and package it for distribution

$ npm run build && npm run package

Run the tests ✔️

$ npm test

> [email protected] test
> jest

 PASS  __tests__/main.test.ts
...
Test Suites: 1 passed, 1 total
Tests:       105 passed, 105 total
Snapshots:   0 total
Time:        0.994 s, estimated 1 s
Ran all test suites.

Publish to a distribution branch

Actions are run from GitHub repos so we will checkin the packed dist folder.

Then run ncc and push the results:

$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1

Note: We recommend using the --license option for ncc, which will create a license file for all of the production node modules used in your project.

Your action is now published! 🚀

See the versioning documentation

Validate

You can now validate the action by referencing ./ in a workflow in your repo (see test.yml)

- uses: ./
  id: role-session-name

See the actions tab for runs of this action! 🚀

Usage:

After testing you can create a v1 tag to reference the stable and latest V1 action