mongo-c-driver 1.28.0 #13600
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Clean up closed PRs | |
on: | |
pull_request_target: | |
types: | |
- closed | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number }} | |
cancel-in-progress: true | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_NO_UPDATE_NOTIFIER: 1 | |
GH_PROMPT_DISABLED: 1 | |
PR: ${{ github.event.number }} | |
jobs: | |
cancel-tests: | |
if: > | |
github.repository_owner == 'Homebrew' && | |
!github.event.pull_request.merged | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/homebrew/ubuntu22.04:master | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read | |
actions: write # for `gh run cancel` | |
checks: read # for `GitHub.get_workflow_run` | |
steps: | |
- name: Set up Homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
with: | |
core: false | |
cask: false | |
test-bot: false | |
- name: Check CI status | |
id: check | |
env: | |
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
brew check-ci-status --cancel "$PR" | |
- name: Cancel tests | |
if: fromJson(steps.check.outputs.cancellable-run-id) != null | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
RUN_ID: ${{ fromJson(steps.check.outputs.cancellable-run-id) }} | |
run: | | |
echo "::notice ::Cancelling tests on closed PR #$PR" | |
gh run cancel "$RUN_ID" | |
delete-branch: | |
if: > | |
github.repository_owner == 'Homebrew' && | |
github.event.pull_request.head.repo.full_name == github.repository && | |
!github.event.pull_request.merged | |
runs-on: ubuntu-latest | |
# Ignore errors as branch may already be deleted | |
continue-on-error: true | |
permissions: | |
contents: write | |
steps: | |
- name: Delete branch | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: ${{ github.event.pull_request.head.ref }} | |
run: | | |
gh api \ | |
-X DELETE \ | |
--header 'Accept: application/vnd.github+json' \ | |
--header 'X-GitHub-Api-Version: 2022-11-28' \ | |
"repos/$GITHUB_REPOSITORY/git/refs/heads/$BRANCH" |