Update UniFMIRDenoiseOnPlanaria #331
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
# if an auto-update-pr was closed (and not merged) we delete the branch to detect the resource anew | |
# and reopen a new, potentially updated pr | |
on: | |
pull_request: | |
branches: [ main ] | |
types: [ closed ] | |
jobs: | |
run: | |
if: github.event.pull_request.merged == false # if pr was merged the branch is deleted via gh settings | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: check if remote still exists | |
id: ls-remote | |
run: | | |
out=$(git ls-remote --heads origin ${{ github.event.pull_request.head.ref }}) | |
echo "out=(echo $out)" >> $GITHUB_OUTPUT | |
- name: delete PR branch ${{ github.event.pull_request.head.ref }} | |
if: contains(steps.ls-remote.outputs.out, 'auto-update-') # only delete existing auto-update- branches | |
run: git push origin --delete ${{ github.event.pull_request.head.ref }} | |
- name: trigger collection update | |
shell: python | |
run: | | |
import os | |
import requests | |
r = requests.post( | |
"${{ github.api_url }}/repos/${{ github.repository }}/actions/workflows/auto_update_main.yaml/dispatches", | |
headers=dict( | |
Accept="application/vnd.github.v3+json", | |
Authorization="token ${{ secrets.PAT }}", | |
), | |
json=dict(ref="refs/heads/main"), | |
) | |
r.raise_for_status() |