name: 📝 RootCA Update

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

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

jobs:
  rootca:
    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-rootcerts@latest
      - run: update-rootcerts -out-root-certs ./assets/root-certs.pem
      - uses: projectdiscovery/actions/commit@v1
        with:
          files: 'assets/root-certs.pem'
          message: 'chore: root CA update :robot:'
      - name: Push changes
        run: |
          git pull origin $GITHUB_REF --rebase
          git push origin $GITHUB_REF
