Merge pull request #19 from NangoHQ/khaliq/nan-1762-fix-linting-issue… #22
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 to Nango repo | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: push-flows-${{ github.event.pull_request.number || 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." | |
- name: Debug - Log nango directory contents | |
if: steps.changes.outputs.any_changed == 'true' | |
run: | | |
echo "Contents of nango directory after copying flows.yaml:" | |
ls nango/ | |
- 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" | |
git add packages/shared/flows.yaml | |
git commit -m "chore(integration-templates): Automated commit updating flows.yaml from the integration-templates repo" | |
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." |