feat: AWS Security & Compliance β finding-to-code mapping with AI remediation #21366
This file contains hidden or 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
| name: vhs | |
| on: | |
| pull_request: | |
| types: [labeled, opened, synchronize] | |
| env: | |
| TERM: "xterm-256color" | |
| COLORTERM: "truecolor" | |
| LANG: "en_US.UTF-8" | |
| ATMOS_LOGS_LEVEL: "Info" | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check for vhs label | |
| id: labeled | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GH_REPO: ${{ github.repository }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| labels=$(gh api "repos/${GH_REPO}/issues/${PR_NUMBER}/labels" | jq -r '.[].name') | |
| if [[ $labels =~ "vhs" ]]; then | |
| echo "labeled=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "labeled=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Get modified .tape files | |
| id: tapes | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| IS_LABELED: ${{ steps.labeled.outputs.labeled }} | |
| run: | | |
| if [[ "$IS_LABELED" == "true" ]]; then | |
| echo "files=$(find . -path './build-harness' -prune -o -type f -name '*.tape' ! -name 'style.tape' ! -name 'defaults.tape' -print | cut -d/ -f2-)" >> $GITHUB_OUTPUT | |
| else | |
| files=$(gh pr diff --name-only "$PR_NUMBER" | (grep '\.tape$' | grep -v '(style|defaults)\.tape$' || true) | cut -d/ -f2-) | |
| echo "files=$files" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up matrix | |
| id: create-matrix | |
| env: | |
| TAPE_FILES: ${{ steps.tapes.outputs.files }} | |
| run: | | |
| echo "matrix=$(echo -n "$TAPE_FILES" | jq -R -s -c 'split(" ")')" >> $GITHUB_OUTPUT | |
| outputs: | |
| matrix: ${{ steps.create-matrix.outputs.matrix }} | |
| labeled: ${{ steps.labeled.outputs.labeled }} | |
| vhs: | |
| needs: [prepare] | |
| if: needs.prepare.outputs.matrix != '[]' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| file: ${{fromJson(needs.prepare.outputs.matrix)}} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.file }} | |
| cancel-in-progress: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install atmos | |
| uses: jaxxstorm/action-install-gh-release@v1.14.0 | |
| with: # Grab the latest version | |
| repo: cloudposse/atmos | |
| chmod: 0755 | |
| extension-matching: disable | |
| rename-to: atmos | |
| - uses: charmbracelet/vhs-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| path: ${{ matrix.file }} | |
| install-fonts: true | |
| - uses: stefanzweifel/git-auto-commit-action@v4 | |
| id: auto-commit | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| commit_message: "chore: update demo gif" | |
| commit_user_name: vhs-action πΌ | |
| commit_user_email: actions@github.com | |
| commit_author: vhs-action πΌ <actions@github.com> | |
| file_pattern: '*.gif' | |
| - name: Add Image to Job Summary | |
| if: steps.auto-commit.outputs.changes_detected == 'true' | |
| env: | |
| GH_REPO: ${{ github.repository }} | |
| COMMIT_HASH: ${{ steps.auto-commit.outputs.commit_hash }} | |
| run: | | |
| echo "## Demo GIF" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| - name: No changes | |
| if: steps.auto-commit.outputs.changes_detected == 'false' | |
| run: | | |
| echo "No changes to demo" >> $GITHUB_STEP_SUMMARY |