Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding registry automation #152

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/registry-updates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
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: 0

- name: Get changed files and write the outputs to a JSON file
id: changed-files-write-output-files-json
uses: tj-actions/changed-files@v44
with:
write_output_files: true
json: true
files: |
registry/**


- name: Verify the contents of the .github/outputs/added_files.json file
run: |
cat "**** OUTPUT ******************"
cat .github/outputs/added_files.json

# - name: Get the list of changed files
# id: changed-files
# run: |
# echo "Fetching list of changed files..."
# CHANGED_FILES=$(jq -r '.pull_request | .head.sha as $head | .base.sha as $base | [.head.repo.full_name, $head, $base] | @sh' <<< "$GITHUB_EVENT")
# IFS=' ' read -r REPO HEAD_SHA BASE_SHA <<< "$CHANGED_FILES"
# git diff --name-only $BASE_SHA $HEAD_SHA > changed_files.txt
# cat changed_files.txt
# env:
# GITHUB_EVENT: ${{ toJson(github.event) }}

# - name: Display changed files
# run: 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.changed-files.outputs.base }}
# HEAD_SHA: ${{ steps.changed-files.outputs.head }}

# - 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ implementation][NDC reference].

[NDC specification]: http://hasura.github.io/ndc-spec/
[NDC reference]: https://github.com/hasura/ndc-spec/tree/main/ndc-reference

Empty file added registry-automation/LICENSE
Empty file.
Loading
Loading