Update Ecosystem #10
This file contains hidden or 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: Update Ecosystem | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| update-ecosystem: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| - name: Create new branch | |
| run: | | |
| # Get current date for branch name | |
| branch_name="ecosystem-update-$(date +'%Y-%m-%d-%H-%M')" | |
| git checkout -b $branch_name | |
| echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV | |
| echo "Created branch: $branch_name" | |
| - name: Update ecosystem | |
| env: | |
| ATTIO_API_TOKEN: ${{ secrets.ATTIO_API_TOKEN }} | |
| run: node scripts/attio/updateEcosystem.js | |
| - name: Commit changes | |
| run: | | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --local user.name "github-actions[bot]" | |
| git add data.json logos/ | |
| git commit -m "chore: update ecosystem data" || echo "No changes to commit" | |
| - name: Push changes | |
| run: | | |
| git push origin ${{ env.BRANCH_NAME }} | |
| - name: Create Pull Request | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const prBody = `🤖 This PR was automatically generated to update the ecosystem database. | |
| ## Changes | |
| - Updated \`data.json\` with latest ecosystem data | |
| - Updated company logos in \`logos/\` directory | |
| Please review the changes and merge if everything looks correct.`; | |
| const { data: pr } = await github.rest.pulls.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: "chore: update ecosystem data", | |
| head: "${{ env.BRANCH_NAME }}", | |
| base: "main", | |
| body: prBody, | |
| maintainer_can_modify: true | |
| }); | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| labels: ["automated", "ecosystem-update"] | |
| }); |