forked from aj-foster/open-api-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2 KB
/
diff-generate.yml
File metadata and controls
82 lines (70 loc) · 2 KB
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
name: Diffs
on:
push:
branches:
- main
pull_request: {}
workflow_dispatch:
inputs:
ref:
description: Ref of aj-foster/open-api-generator
required: true
type: string
permissions:
contents: write
issues: write
pull-requests: write
jobs:
generate:
name: Generate
runs-on: ubuntu-latest
steps:
- name: Setup Ref (Push)
if: github.event_name == 'push'
run: |
echo "REF=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Setup Ref (Pull Request)
if: github.event_name == 'pull_request'
run: |
echo "REF=pr/$GITHUB_REF_NAME" >> $GITHUB_ENV
- name: Setup Ref (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo "REF=${{ inputs.ref }}" >> $GITHUB_ENV
- name: Checkout (Diffs)
uses: actions/checkout@v4
with:
repository: "aj-foster/open-api-diffs"
ref: main
path: diffs
- name: Checkout (Generator) (Push or PR)
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
with:
repository: "aj-foster/open-api-generator"
path: generator
- name: Checkout (Generator) (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
repository: "aj-foster/open-api-generator"
path: generator
- name: Setup BEAM
uses: erlef/setup-beam@v1
with:
otp-version: "27.0"
elixir-version: "1.17.1"
- name: Generate Code
run: |
cd diffs/
elixir generate.exs "path:../generator"
- name: Save PR number
run: |
echo ${{ github.event.number }} > diffs/output/pr_number.txt
echo $REF > diffs/output/ref.txt
- name: Save Artifact
uses: actions/upload-artifact@v4
with:
name: diffs
path: diffs/output