feat(BUILD-2568): short syntax to retrieve secrets #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# yamllint disable rule:truthy | |
name: Test action | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/test.yaml | |
- action.yaml | |
jobs: | |
vault-action: | |
runs-on: ubuntu-22.04 | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: exec vault-action | |
id: actual | |
uses: ./ | |
with: | |
url: https://vault.staging.sonar.build:8200 | |
secrets: | | |
development/github/token/{REPO_OWNER_NAME_DASH}-ro token | github_ro; | |
development/github/token/{REPO_OWNER_NAME_DASH}-ro org_name | org_name; | |
- name: validate token | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ fromJSON(steps.actual.outputs.vault).github_ro }} | |
GITHUB_TOKEN_SHORT_SYNTAX: ${{ steps.actual.outputs.github_ro }} | |
run: | | |
GH_TOKEN="${GITHUB_TOKEN}" gh workflow list --all | grep "Test action" | |
GH_TOKEN="${GITHUB_TOKEN_SHORT_SYNTAX}" gh workflow list --all | grep "Test action" | |
- name: validate org_name | |
shell: bash | |
env: | |
ORG_NAME: ${{ fromJSON(steps.actual.outputs.vault).org_name }} | |
ORG_NAME_SHORT_SYNTAX: ${{ steps.actual.outputs.org_name }} | |
run: | | |
[[ "${ORG_NAME}" = "SonarSource" ]] | |
[[ "${ORG_NAME_SHORT_SYNTAX}" = "SonarSource" ]] |