name: 📝 CipherStatus Update

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * 0'

permissions:
  pull-requests: write
  contents: write
  issues: write
  repository-projects: write

jobs:
  cipherstatus:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: projectdiscovery/actions/setup/git@v1
      - uses: projectdiscovery/actions/setup/go@v1
      - run: go install github.com/projectdiscovery/tlsx/cmd/update-cipherstatus@latest
      - run: update-cipherstatus -out-ciphers ./assets/cipherstatus_data.json
      - uses: projectdiscovery/actions/commit@v1
        with:
          files: 'assets/cipherstatus_data.json'
          message: 'chore: cipherstatus update :robot:'
      - name: Push changes
        run: |
          git pull origin $GITHUB_REF --rebase
          git push origin $GITHUB_REF