name: Working Secrets Test
on: [push]

jobs:
  test-secrets:
    runs-on: ubuntu-latest
    steps:
      - name: Test environment variable secrets
        env:
          MY_SECRET: ${{ secrets.TEST_SECRET }}
          API_KEY: ${{ secrets.API_KEY }}
        run: |
          echo "Secret length: ${#MY_SECRET}"
          echo "API Key length: ${#API_KEY}"
          echo "API Key exists: $([ -n "$API_KEY" ] && echo "yes" || echo "no")"
          
      - name: Test direct secret usage in commands
        run: |
          echo "Using secret directly: ${{ secrets.TEST_SECRET }}"
          echo "Using GitHub token: ${{ secrets.GITHUB_TOKEN }}"
          
      - name: Test secret in variable assignment
        run: |
          SECRET_VAL="${{ secrets.TEST_SECRET }}"
          echo "Secret value length: ${#SECRET_VAL}"
          
      - name: Test multiple secrets in one command
        run: |
          echo "Token: ${{ secrets.GITHUB_TOKEN }}, Key: ${{ secrets.API_KEY }}"
          
  test-masking:
    runs-on: ubuntu-latest
    steps:
      - name: Test automatic token masking
        run: |
          echo "GitHub token should be masked: ${{ secrets.GITHUB_TOKEN }}"
          echo "API key should be masked: ${{ secrets.API_KEY }}"
          
      - name: Test pattern masking
        env:
          DEMO_TOKEN: ghp_1234567890abcdef1234567890abcdef12345678
          AWS_KEY: AKIAIOSFODNN7EXAMPLE
        run: |
          echo "Demo GitHub token: $DEMO_TOKEN"
          echo "Demo AWS key: $AWS_KEY"
          echo "These should be automatically masked"
