From 5f3896272fcfc75556364d743e9faf6f1a40f4ea Mon Sep 17 00:00:00 2001 From: Hung Cao Hiep Date: Tue, 1 Apr 2025 11:02:32 +0200 Subject: [PATCH] feat: add codeartifact/get-token JIRA: INFRA-3949 risk:nonprod --- codeartifact/get-token/README.md | 39 +++++++++++++++++++++++++++++++ codeartifact/get-token/action.yml | 16 +++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 codeartifact/get-token/README.md create mode 100644 codeartifact/get-token/action.yml diff --git a/codeartifact/get-token/README.md b/codeartifact/get-token/README.md new file mode 100644 index 0000000..01f06c5 --- /dev/null +++ b/codeartifact/get-token/README.md @@ -0,0 +1,39 @@ +# Code artifact get auth token + +This action authenticates with aws code artifact and get the token. +Then the token will be injected into environment variable `CODEARTIFACT_AUTH_TOKEN`. + +Note: This action only works on `infra1-runners-arc`. + +## Inputs + +*None* + +## Outputs + +*None* + +## Example usage + +``` +name: Run gradle check + +on: + pull_request: + +jobs: + check: + runs-on: + group: infra1-runners-arc + labels: runners-small + steps: + - uses: actions/checkout@v3 + + - uses: gooddata/github-actions/codeartifact/get-token@master + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Check + run: ./gradlew -I src/init.d/init.gradle.kts check --scan +``` \ No newline at end of file diff --git a/codeartifact/get-token/action.yml b/codeartifact/get-token/action.yml new file mode 100644 index 0000000..93881fc --- /dev/null +++ b/codeartifact/get-token/action.yml @@ -0,0 +1,16 @@ +--- +name: "Get code artifact authen token" +description: "Get code artifact authen token" +runs: + using: "composite" + steps: + - name: CODEARTIFACT_AUTH_TOKEN + shell: bash + run: | + CODEARTIFACT_AUTH_TOKEN=` + aws codeartifact get-authorization-token \ + --domain infra1 \ + --domain-owner 020413372491 \ + --region us-east-1 --query authorizationToken --output text` + echo "CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN" >> $GITHUB_ENV + echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN"