forked from sam-logik/github-logik-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (54 loc) · 2.14 KB
/
blueprint_pull.yaml
File metadata and controls
62 lines (54 loc) · 2.14 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
name: Logik - Pull Blueprint
on:
workflow_dispatch:
inputs:
NAME:
description: "Blueprint Variable Name"
type: string
jobs:
pull_and_commit_blueprint:
runs-on: ubuntu-latest
steps:
- name: Get Current Time
id: now
run: echo "NOW=$(date +'%Y-%m-%dT%H.%M.%S')" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v3
- name: Start Export Blueprint
id: start_export_blueprint
run: |
wget --header="accept: application/json" \
--header="content-type: application/json" \
--header='Authorization: Bearer ${{ secrets.LOGIK_SOURCE_API }}' \
--compression=auto \
--post-data='["${{ github.event.inputs.NAME }}"]' \
--output-document=exportJob.json \
${{ vars.LOGIK_SOURCE_URL }}api/admin/v1/bulk/blueprints/export
- name: Get Job Id
id: get_job_id
run: echo "JOB_ID=$(jq .id exportJob.json)" >> $GITHUB_OUTPUT
- name: Generate Export URL
id: generate_export_url
run: echo "EXPORT_URL=${{ vars.LOGIK_SOURCE_URL }}api/admin/v2/bulk/export/${{ steps.get_job_id.outputs.JOB_ID }}" >> $GITHUB_OUTPUT
- name: Sleep for 30 seconds
id: sleep
uses: jakejarvis/wait-action@master
with:
time: "30s"
- name: Download Blueprint
id: download_blueprint
run: |
wget --header="accept: application/octet-stream" \
--header="Authorization: Bearer ${{ secrets.LOGIK_SOURCE_API }}" \
--compression=auto \
--output-document=export.zip \
${{ steps.generate_export_url.outputs.EXPORT_URL }}
- name: Extract Blueprint
id: extract_blueprint
run: mkdir -p ${{ github.event.inputs.NAME }} && unzip -o export.zip -d ${{ github.event.inputs.NAME }}
- name: Add and Commit
uses: EndBug/add-and-commit@v9
with:
add: "${{ github.event.inputs.NAME }}"
message: "Blueprint ${{ github.event.inputs.NAME }}"
new_branch: "${{ github.event.inputs.NAME }}-${{ steps.now.outputs.NOW}}"