-
Notifications
You must be signed in to change notification settings - Fork 7
91 lines (81 loc) · 3.11 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
name: Update Hub DB from GH Registry (Staging)
on:
pull_request_target:
branches:
- main
types: [opened, synchronize, reopened]
paths:
- registry/**
pull_request:
branches:
- kc/record-latest-version
- main
types: [opened, synchronize, reopened]
paths:
- registry/**
jobs:
update_registry_db:
runs-on: ubuntu-latest
environment: staging
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# In the case of forked PRs, the forked repository will
# be checked out.
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 1
# - name: Check for PR approvals
# id: check-approval
# uses: actions/github-script@v7
# with:
# script: |
# const { owner, repo } = context.issue;
# const pull_number = context.payload.pull_request.number;
# console.log("Owner and repo and pull_number", owner, repo, pull_number);
# const { data: reviews } = await github.rest.pulls.listReviews({
# owner: context.repo.owner,
# repo: context.repo.repo,
# pull_number: context.payload.pull_request.number,
# });
# const approved = reviews.some(review => review.state === 'APPROVED');
# if (!approved) {
# core.setFailed('This workflow will only run when the PR is approved by someone in Hasura')
# }
- name: Get all connector version package changes
id: connector-version-changed-files
uses: tj-actions/changed-files@v44
with:
json: true
escape_json: false
files: |
registry/**
- name: Print out all the changed filse
env:
ADDED_FILES: ${{ steps.connector-version-changed-files.outputs.added_files }}
MODIFIED_FILES: ${{ steps.connector-version-changed-files.outputs.modified_files }}
DELETED_FILES: ${{ steps.connector-version-changed-files.outputs.deleted_files }}
run: |
echo "{\"added_files\": $ADDED_FILES, \"modified_files\": $MODIFIED_FILES, \"deleted_files\": $DELETED_FILES}" > changed_files.json
- name: List changed files
id: list_files
run: |
cat changed_files.json
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.x
- name: Run registry automation program
env:
CHANGED_FILES_PATH: "changed_files.json"
PUBLICATION_ENV: "staging"
CONNECTOR_REGISTRY_GQL_URL: ${{ secrets.CONNECTOR_REGISTRY_GQL_URL }}
GCP_BUCKET_NAME: ${{ secrets.GCP_BUCKET_NAME }}
GCP_SERVICE_ACCOUNT_DETAILS: ${{ secrets.GCP_SERVICE_ACCOUNT_DETAILS }}
CONNECTOR_PUBLICATION_KEY: ${{ secrets.CONNECTOR_PUBLICATION_KEY }}
CLOUDINARY_URL: ${{ secrets.CLOUDINARY_URL }}
run: |
mv changed_files.json registry-automation/changed_files.json
cd registry-automation
go run main.go ci