Files
pytorch/.github/workflows/delete_old_branches.yml
Thanh Ha 79e8dc7d53 Pin to SHA for actions outside of PyTorch (#152110)
Pin actions from repos external to the PyTorch project to their shasums for security. This is a best practice as Git tags are not immutable.

https://openssf.org/blog/2024/08/12/mitigating-attack-vectors-in-github-workflows/

Pull Request resolved: https://github.com/pytorch/pytorch/pull/152110
Approved by: https://github.com/seemethere, https://github.com/ZainRizvi
2025-04-28 17:57:32 +00:00

40 lines
891 B
YAML

# A workflow that deletes branches of closed PRs
name: Delete old branches
on:
schedule:
# Run daily.
- cron: 30 1 * * *
workflow_dispatch:
concurrency:
group: delete-old-branches
cancel-in-progress: true
permissions:
contents: write
jobs:
delete:
if: ${{ github.repository == 'pytorch/pytorch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.11'
architecture: x64
check-latest: false
- name: Delete old branches
run: python .github/scripts/delete_old_branches.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}