-
Notifications
You must be signed in to change notification settings - Fork 203
71 lines (68 loc) · 2.25 KB
/
pst-amt-sock-kickoff.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
name: SOCKS Issue creation kickoff Workflow
on:
issues:
types: [opened, edited, reopened]
env:
ISSUE_ID: ${{ github.event.issue.number }}
GH_REPO_FOR_ISSUES: department-of-veterans-affairs/va.gov-team
jobs:
parse_ssh_key:
if: contains(github.event.issue.title, 'SOCKS access')
runs-on: ubuntu-latest
outputs:
ssh_key: ${{ fromJSON(steps.parse.outputs.payload)[' Public SSH Key'] }}
steps:
- name: Run Issue form parser
id: parse
uses: department-of-veterans-affairs/issue-forms-body-parser@main
with:
issue_id: ${{ env.ISSUE_ID }}
repository: ${{ env.GH_REPO_FOR_ISSUES }}
separator: '###'
label_marker_start: " "
label_marker_end: "\n"
validate_ssh_key:
if: contains(github.event.issue.title, 'SOCKS access')
runs-on: ubuntu-latest
needs: parse_ssh_key
env:
PUBLIC_KEY: "${{ needs.parse_ssh_key.outputs.ssh_key }}"
steps:
- name: Run ssh public key validation
id: fingerprint
shell: bash
run: ssh-keygen -lf /dev/stdin <<< "$PUBLIC_KEY"
- name: Notify failure
id: ssh_key_invalid
if: ${{ failure() }}
shell: bash
run: |
echo "::error:: You seem to have uploaded an invalid ssh public key: $PUBLIC_KEY"
- name: Comment issue
if: ${{ failure() }}
uses: KeisukeYamashita/create-comment@v1
with:
token: ${{ secrets.VA_VSP_BOT_GITHUB_TOKEN }}
number: ${{ env.ISSUE_ID }}
comment: |
:x: The attached ssh key failed to validate
start_workflow:
runs-on: ubuntu-latest
needs: validate_ssh_key
name: Start workflow in devops repo
if: contains(github.event.issue.title, 'SOCKS access')
steps:
- name: Run workflow
uses: actions/github-script@v6
with:
github-token: ${{ secrets.VA_VSP_BOT_GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'department-of-veterans-affairs',
repo: 'devops',
workflow_id:'pst-amt-roster-check.yml',
ref: 'master',
inputs: {
issue_id: "${{ env.ISSUE_ID }}"
},
});