This repository was archived by the owner on Sep 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
135 lines (124 loc) · 4.19 KB
/
Copy pathaction.yaml
File metadata and controls
135 lines (124 loc) · 4.19 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# action.yml
name: 'GlassFlow Pipelines Push action'
description: 'This Github Action lets you automate GlassFlow pipelines deployments as code'
branding:
icon: zap
color: purple
inputs:
dry-run:
description: Do not actually push any changes
required: false
default: "false"
glassflow-personal-access-token:
description: |
GlassFlow personal access token to interact with API.
required: true
pipelines-dir:
description: |
Path to directory with GlassFlow pipelines.
Default 'pipelines'
default: "pipelines"
sha:
description: |
SHA from github action commit to use. If empy, it will use latest version.
Default ''
default: ""
outputs:
to-create-count:
description: Number of new pipelines to create
value: ${{ steps.run.outputs.to-create-count }}
to-create-ids:
description: Pipeline IDs that were created
value: ${{ steps.run.outputs.to-create-ids }}
to-update-count:
description: Number of pipelines to update
value: ${{ steps.run.outputs.to-update-count }}
to-update-ids:
description: Pipeline IDs that will be updated
value: ${{ steps.run.outputs.to-update-ids }}
to-delete-count:
description: Number of pipelines to delete
value: ${{ steps.run.outputs.to-delete-count }}
to-delete-ids:
description: Pipeline IDs that will be deleted
value: ${{ steps.run.outputs.to-delete-ids }}
space-to-create-count:
description: Number of spaces to be created
value: ${{ steps.run.outputs.space-to-create-count }}
spaces-to-create-ids:
description: Space IDs that were created
value: ${{ steps.run.outputs.spaces-to-create-ids }}
runs:
using: "composite"
steps:
- name: Get file changes
id: changed-files
uses: tj-actions/changed-files@v45
with:
recover_deleted_files: 'true'
recover_files: |
${{ inputs.pipelines-dir }}/**/*.{yaml,yml}
files: |
${{ inputs.pipelines-dir }}/**/*.{py,yaml,yml}
${{ inputs.pipelines-dir }}/**/requirements.txt
- name: Download repo
shell: bash
id: setup
run: |
SHA="${{ inputs.sha }}"
if [ ${SHA} ];
then
VERSION=$(echo ${SHA} | cut -c1-7)
ARCHIVE="${VERSION}.tar.gz"
SCRIPT_DIR="pipelines-push-action-${SHA}"
else
VERSION=1
ARCHIVE="refs/tags/v${VERSION}.tar.gz"
SCRIPT_DIR="pipelines-push-action-${VERSION}"
fi;
TEMPDIR=/tmp/action-script/
mkdir -p ${TEMPDIR}
cd ${TEMPDIR}
echo "tempdir=${TEMPDIR}${SCRIPT_DIR}" >> $GITHUB_OUTPUT
echo "Downloading action script ..."
wget "https://github.com/glassflow/pipelines-push-action/archive/${ARCHIVE}"
tar -xzvf *.tar.gz
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "${{ steps.setup.outputs.tempdir }}/pyproject.toml"
cache: 'pip'
- name: Install dependencies
shell: bash
run: pip install -e ${{ steps.setup.outputs.tempdir }}
- name: Set arguments
id: set-arguments
shell: bash
run: |
args="args=-t ${{ inputs.glassflow-personal-access-token }} --pipelines-dir ${{ inputs.pipelines-dir }}";
if ${{ inputs.dry-run == 'true' }};
then
args+=" --dry-run";
fi;
if [ "${{ steps.changed-files.outputs.deleted_files }}" ];
then
args+=" --files-deleted ${{ steps.changed-files.outputs.deleted_files }}";
fi;
if [ "${{ steps.changed-files.outputs.all_changed_files }}" ];
then
args+=" --files-changed ${{ steps.changed-files.outputs.all_changed_files }}";
fi;
echo $args >> $GITHUB_OUTPUT
- name: Run
id: run
shell: bash
run: pipelines-push-action ${{ steps.set-arguments.outputs.args }}
- name: Clean up
id: clean-up
shell: bash
run: rm -rf ${{ steps.setup.outputs.tempdir }}
- name: Commit new Pipeline IDs
if: ${{ (inputs.dry-run == 'false') && steps.run.outputs.to-create-ids }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply automatic changes (add new pipeline IDs)