-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
90 lines (85 loc) · 3.01 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
name: "Data Dictionary"
description: "Generate and check freshness of data dictionaries"
inputs:
store-name:
description: "Name of the data store."
required: true
store-type:
description: "Type of the data store."
required: true
tool-type:
description: "Type of the data tool (e.g. migration)."
required: true
tool-path:
description: "Path to the data tool files (e.g. migration)."
required: true
dictionary-app-id:
description: "Dictionary GitHub App ID"
required: true
dictionary-app-private-key:
description: "Dictionary GitHub App private key"
required: true
exclude-tables:
description: "Comma-separated table names to exclude from dictionary."
required: false
proto-path:
description: "Path to the proto files."
required: false
repo-token:
description: "GitHub auth token for pull request comments (NOT for commits)."
required: false
default: ${{ github.token }}
required-roles:
description: "Any user roles which the application expects to exist before migrating. Separate with whitespace if multiple are required, e.g. `admin develop`."
required: false
dictionary-repo:
description: "Name of the Dictionary repo"
required: false
default: "data-dictionary"
dictionary-ref:
description: "Ref of the Dictionary repo"
required: false
default: "master"
dictionary-workflow:
description: "Name of the Dictionary build workflow"
required: false
default: "build.yml"
runs:
using: "composite"
steps:
- run: pip3 install -r ${{ github.action_path }}/requirements.txt
if: ${{ github.event_name == 'pull_request' }}
shell: bash
- run: ${{ github.action_path }}/action.sh
if: ${{ github.event_name == 'pull_request' }}
shell: bash
env:
STORE_NAME: ${{ inputs.store-name }}
STORE_TYPE: ${{ inputs.store-type }}
EXCLUDE_TABLES: ${{ inputs.exclude-tables }}
TOOL_TYPE: ${{ inputs.tool-type }}
TOOL_PATH: ${{ inputs.tool-path }}
PROTO_PATH: ${{ inputs.proto-path }}
REQUIRED_ROLES: ${{ inputs.required-roles }}
GITHUB_TOKEN: ${{ inputs.repo-token }}
GITHUB_PULL: ${{ github.event.pull_request.number }}
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
if: ${{ github.ref == 'refs/heads/master' }}
with:
app-id: ${{ inputs.dictionary-app-id }}
private-key: ${{ inputs.dictionary-app-private-key }}
owner: ${{ github.repository_owner }}
- name: Trigger Dictionary build
uses: actions/github-script@v6
if: ${{ github.ref == 'refs/heads/master' }}
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: '${{ github.repository_owner }}',
repo: '${{ inputs.dictionary-repo }}',
workflow_id: '${{ inputs.dictionary-workflow }}',
ref: '${{ inputs.dictionary-ref }}',
})