fix(test): Set limit on first page (#160) #154
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push flows and docs to Nango repo | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: push-flows-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
push_to_nango_repo: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the current repository | |
uses: actions/checkout@v3 | |
- name: Log current branch and repository | |
run: | | |
echo "Current branch: ${{ github.ref }}" | |
echo "Repository: ${{ github.repository }}" | |
- name: Check for changes in flows.yaml | |
id: changes | |
uses: tj-actions/changed-files@v41 | |
with: | |
files: 'flows.yaml' | |
- name: Debug - Log if flows.yaml has changed | |
run: | | |
if [ "${{ steps.changes.outputs.any_changed }}" == "true" ]; then | |
echo "flows.yaml has changed." | |
else | |
echo "No changes detected in flows.yaml." | |
fi | |
- name: Generate GitHub App Token | |
if: steps.changes.outputs.any_changed == 'true' | |
id: generate_token | |
uses: tibdex/github-app-token@v1 | |
with: | |
app_id: ${{ secrets.GH_APP_PUSHER_ID }} | |
private_key: ${{ secrets.GH_APP_PUSHER_PRIVATE_KEY }} | |
- name: Debug - Log token generation status | |
if: steps.changes.outputs.any_changed == 'true' | |
run: | | |
echo "GitHub App token generated." | |
- name: Clone the target repository and copy the flows.yaml file | |
if: steps.changes.outputs.any_changed == 'true' | |
run: | | |
echo "Cloning the target repository..." | |
git clone https://x-access-token:${{ steps.generate_token.outputs.token }}@github.com/NangoHQ/nango.git | |
echo "Repository cloned." | |
echo "Copying flows.yaml into the nango repository." | |
cp flows.yaml nango/packages/shared/flows.yaml | |
echo "flows.yaml file copied." | |
echo "Updating documentation snippets" | |
cd nango | |
npm ci | |
npm run docs:generate | |
- name: Debug - status on nango after copying | |
if: steps.changes.outputs.any_changed == 'true' | |
working-directory: nango | |
run: | | |
echo "Status of nango directory after copying flows.yaml:" | |
git status | |
- name: Get Commit Details | |
if: steps.changes.outputs.any_changed == 'true' | |
id: commit_details | |
run: | | |
# Get the latest commit details | |
COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s") | |
COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an") | |
COMMIT_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }}" | |
echo "Commit message: $COMMIT_MESSAGE" | |
echo "Commit author: $COMMIT_AUTHOR" | |
echo "Commit URL: $COMMIT_URL" | |
# Write them to the GITHUB_OUTPUT environment file | |
echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT | |
echo "commit_author=$COMMIT_AUTHOR" >> $GITHUB_OUTPUT | |
echo "commit_url=$COMMIT_URL" >> $GITHUB_OUTPUT | |
- name: Make changes and commit | |
if: steps.changes.outputs.any_changed == 'true' | |
working-directory: nango | |
run: | | |
echo "Configuring Git and committing changes..." | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "GitHub Actions Bot" | |
# Add the changes | |
git add packages/shared/flows.yaml | |
git add docs-v2/snippets/ | |
# Get commit details from the previous step | |
COMMIT_MESSAGE="${{ steps.commit_details.outputs.commit_message }}" | |
COMMIT_AUTHOR="${{ steps.commit_details.outputs.commit_author }}" | |
COMMIT_URL="${{ steps.commit_details.outputs.commit_url }}" | |
# Commit with a message that includes commit details | |
git commit -m "chore(integration-templates): Automated commit updating flows.yaml based on changes in $COMMIT_URL by $COMMIT_AUTHOR. Commit message: $COMMIT_MESSAGE" | |
echo "Changes committed." | |
- name: Push changes to target repo | |
if: steps.changes.outputs.any_changed == 'true' | |
working-directory: nango | |
run: | | |
echo "Pushing changes to target repository..." | |
git push origin master | |
echo "Changes pushed successfully." |