-
Notifications
You must be signed in to change notification settings - Fork 7
93 lines (78 loc) · 2.9 KB
/
registry-updates.yaml
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
name: Update Hub DB from GH Registry
on:
push:
branches:
- lyndon/registry-automation # TODO: Remove the branch response
paths:
- registry/**
pull_request:
types: [opened, synchronize, reopened, closed]
paths:
- registry/**
jobs:
update_registry_db:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch_depth: 1
- name: Get all changed files and use a comma separator in the output
id: changed-files
uses: tj-actions/changed-files@v44
with:
json: true
files: |
registry/**
- name: Print out all the changed files
env:
ADDED_FILES: ${{ steps.changed-files.outputs.added_files }}
MODIFIED_FILES: ${{ steps.changed-files.outputs.modified_files }}
DELETED_FILES: ${{ steps.changed-files.outputs.deleted_files }}
OUTPUT: ${{ toJson(steps.changed-files.outputs) }}
run: |
echo "**************"
echo "added files are $ADDED_FILES"
echo "modified files are $MODIFIED_FILES"
echo "deleted files are $DELETED_FILES"
echo "OUPTUT is $OUTPUT"
echo '{"added": "$ADDED_FILES", "modified": "$MODIFIED_FILES", "deleted": "$DELETED_FILES"}' | envsubst | jq .
# - name: List changed files
# id: list_files
# run: |
# if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then
# git diff --name-only ${{ github.sha }} > changed_files.txt
# else
# git diff --name-only ${{ github.event.before }} ${{ github.sha }} > changed_files.txt
# fi
# cat changed_files.txt
# - name: Get the actual changes in the files
# run: |
# echo "Fetching actual changes ..."
# while read -r FILE; do
# echo "Changes in $FILE: "
# git diff $BASE_SHA $HEAD_SHA -- "$FILE"
# done < changed_files.txt
# env:
# BASE_SHA: ${{ steps.list_files.outputs.base }}
# HEAD_SHA: ${{ steps.list_files.outputs.head }}
# - name: Pseudocode for Next steps
# id: next_steps
# run: |
# echo 'Detect status - added/modified/removed files'
# echo 'for each removed connector, remove from registry db'
# echo 'for each added connector, create a stub in the registry db'
# echo 'for each modified connector:'
# echo ' * Download tgz'
# echo ' * Re-upload tgz'
# echo ' * Extract'
# echo ' * Build payload for API'
# echo ' * PUT to API (gql)'
# - name: Setup Go
# uses: actions/setup-go@v4
# with:
# go-version: 1.21.x
# - name: Run registry automaion program
# run: |
# cd registry-automation
# go run main.go ci