ci: Automatically close existing PRs for test duration updates (#5852)
ci: add step to close existing PRs before creating a new one for test duration updates - Introduced a new step in the GitHub Actions workflow to automatically close any open pull requests titled "chore: update test durations" before creating a new pull request. - This change ensures that only one pull request for updating test durations is active at a time, streamlining the workflow and reducing potential merge conflicts.
This commit is contained in:
parent
a3fe2fec90
commit
16448e4247
1 changed files with 22 additions and 0 deletions
22
.github/workflows/store_pytest_durations.yml
vendored
22
.github/workflows/store_pytest_durations.yml
vendored
|
|
@ -49,6 +49,28 @@ jobs:
|
|||
- name: Minimize uv cache
|
||||
run: uv cache prune --ci
|
||||
|
||||
- name: Close existing PRs
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const { data: pulls } = await github.rest.pulls.list({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
state: 'open'
|
||||
});
|
||||
|
||||
for (const pull of pulls) {
|
||||
if (pull.title === "chore: update test durations") {
|
||||
await github.rest.pulls.update({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: pull.number,
|
||||
state: 'closed'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue