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

fix(integration-templates): add workflow and edit existing #2337

Merged
merged 1 commit into from
Jun 18, 2024
Merged
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
13 changes: 11 additions & 2 deletions .github/workflows/integration-template-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,20 @@ jobs:
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
wd=$(pwd)

echo "Changed files:"
echo "${{ steps.changed-files-specific.outputs.all_changed_files }}"

for file in ${{ steps.changed-files-specific.outputs.all_changed_files }}; do
dir=$(dirname $file)

dir=${dir//\/syncs/}
dir=${dir//\/actions/}
parts=(${dir//\// })
if [ ${#parts[@]} -gt 1 ]; then
unset parts[-2]
fi

dir=$(IFS=/; echo "${parts[*]}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want more bash magic I think you can do this with a one liner:

dir=${dir%/*/*}/${dir##*/}

Removing the last 2 elements of the path with the first curly bracket and re-adding the last element in the second


integration=$(basename $dir)

mkdir -p /tmp/nango-temp/nango-integrations
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/sync-integration-templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Sync Integration Templates'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure I follow why we need this extra action. Aren't the merge triggering the templates upload action above done by us, even on external contributions? if yes what's the permissions issue?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is more of a fail safe than anything. It’s a force sync of all templates since the regular one looks just for changed files.

For some reason this action contribution #2242 didnt get uploaded to s3. In that instance we need a way to sync integration templates. I need to look into exactly why it failed but I assumed it was a permissions issue but not 100% sure.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion for future: this could be done at the start of the server process instead


on:
workflow_dispatch:

jobs:
sync-integration-templates:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install nango CLI
run: |
npm install -g nango

- name: Sync all templates
run: |
cd integration-templates
for dir in $(ls -d */); do
mkdir -p /tmp/nango-temp/nango-integrations/$dir

cp $dir/nango.yaml /tmp/nango-temp/nango-integrations/
cp -r $dir/* /tmp/nango-temp/nango-integrations/$dir/

pushd /tmp/nango-temp/nango-integrations
nango compile
popd

cp -r /tmp/nango-temp/nango-integrations/dist ./$dir/dist

rm -rf /tmp/nango-temp

aws s3 sync $dir s3://${{ secrets.AWS_BUCKET_NAME }}/$dir/
done
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Loading