-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (46 loc) · 1.43 KB
/
cleanup-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Cleanup Pull Request
on:
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request_target
pull_request_target:
types: [ closed ]
# https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#workflow_dispatch
workflow_dispatch:
inputs:
pr:
description: 'The number of the pull request to cleanup.'
required: true
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Show Environment
run: env | sort
- name: Show GitHub Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
get_pr_number:
runs-on: ubuntu-latest
outputs:
pr: ${{ steps.get_pr_number.outputs.pr }}
steps:
- name: Get Pull Request Number
id: get_pr_number
shell: bash
run: |
set -euox pipefail
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]]; then
echo "::set-output name=pr::${{ github.event.inputs.pr }}"
else
echo "::set-output name=pr::${{ github.event.number }}"
fi
delete_pr_image:
uses: energy-quants/.github/.github/workflows/cleanup-pr.yml@main
needs: get_pr_number
with:
org: energy-quants
repo: mambaforge
image: mambaforge
pr: ${{ fromJson(needs.get_pr_number.outputs.pr) }}
secrets:
ghcr_token: ${{ secrets.GHCR_TOKEN }}