-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (53 loc) · 2.08 KB
/
demo-issue.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
50
51
52
53
54
55
56
57
name: Example using action 'opt-nc/domaine-nc-action' with an issue creation
on:
workflow_dispatch:
inputs:
domain:
description: Domain name without extenstion
required: true
type: choice
default: opt
options:
- opt
- domain
- '1012'
- ccp
daysBeforeExpiration:
description: Days before domain expiration that triggers new issue
required: true
default: '5'
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Call the action
uses: opt-nc/domaine-nc-action@v1
id: meta
with:
api-key: ${{ secrets.RAPID_API_KEY }}
name: ${{ github.event.inputs.domain }}
- name: Create an warning ⚠️ issue if needed
if: ${{ steps.meta.outputs.expired == 'false' && steps.meta.outputs.daysBeforeExpiration <= github.event.inputs.daysBeforeExpiration }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.create({
owner: '${{ github.repository_owner }}',
repo: '${{ github.repository }}'.split('/')[1],
title: ':warning: Domain ${{ github.event.inputs.domain }}.nc is about to expire :warning:',
body: ':point_right: ${{ github.event.inputs.domain }}.nc will expire on ${{ steps.meta.outputs.expirationDate }}',
labels: ['expired-domain']
});
- name: Create an alert 🚨 issue if needed
if: ${{ steps.meta.outputs.expired == 'true' }}
uses: actions/github-script@v6
with:
script: |
github.rest.issues.create({
owner: '${{ github.repository_owner }}',
repo: '${{ github.repository }}'.split('/')[1],
title: ':rotating_light: Domain ${{ github.event.inputs.domain }}.nc has expired :rotating_light:',
body: ':point_right: ${{ github.event.inputs.domain }}.nc has expired on ${{ steps.meta.outputs.expirationDate }}',
labels: ['expired-domain']
});