-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
94 lines (83 loc) · 2.99 KB
/
action.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: 'Event/API-Catalog Feeder'
description: 'Publish API specifications to an Event/API-Catalog repo by creating a PR.'
inputs:
catalog-repo:
description: 'Repo URL where the Event/API-Catalog is stored'
required: true
domain:
description: 'The domain to which the spec(s) belong to'
required: true
domain-slug:
description: 'domain name without whitespaces or special characters'
required: true
runs:
using: 'composite'
steps:
- name: 'Find specs'
id: find-specs
uses: statista-oss/find-openAPI-Specifications@main
with:
repository: ""
search-dir: ""
head-only: true
- name: 'Display specs'
shell: bash
run: |
echo ${{ steps.find-specs.outputs.spec_files }}
- name: 'Cache found specs'
if: ${{ steps.find-specs.outputs.spec_files != '' }}
uses: actions/upload-artifact@v3
with:
name: specs
path: |
${{ steps.find-specs.outputs.spec_files }}
- name: 'Tidy up the workspace 🧹'
if: ${{ steps.find-specs.outputs.spec_files != '' }}
uses: AutoModality/action-clean@v1
- name: 'Checkout Event/API-Catalog repo'
if: ${{ steps.find-specs.outputs.spec_files != '' }}
uses: actions/checkout@v4
with:
repository: ${{ inputs.catalog-repo }}
path: catalog/
- name: 'Fetch cached spec files'
if: ${{ steps.find-specs.outputs.spec_files != '' }}
uses: actions/download-artifact@v3
with:
name: specs
path: specs/
- name: 'Copy new/updated spec files to Event/API-Catalog repo'
if: ${{ steps.find-specs.outputs.spec_files != '' }}
shell: bash
# todo ⤵️
# we need to create the domain folder
# then we need to create the service folder, based on the spec's name (we assume this as the
# the service name)
# Also versioning needs to somewhat happen
# Maybe using a custom js action is suitable?
run: |
echo 'not there yet'
- name: 'Create Pull Request with new/updated spec files'
if: ${{ steps.find-specs.outputs.spec_files != '' }}
id: create-pr
uses: peter-evans/create-pull-request@v5.0.2
with:
path: catalog/
commit-message: New/Updated spec files for ${{ inputs.domain }} domain
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: spec-feeder-${{ inputs.domain-slug }}-new
delete-branch: true
title: 'New/Updated spec files for ${{ inputs.domain }} domain'
labels: |
automation
# define and set
#team-reviewers: |
# developers
# qa-team
- name: Check outputs
if: ${{ steps.find-specs.outputs.spec_files != '' }}
shell: bash
run: |
echo "Pull Request Number - ${{ steps.create-pr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.create-pr.outputs.pull-request-url }}"