Open BrunoSette opened 1 year ago
I'm trying to run this github action in every new .md file created by tina-cloud-app[bot].
My actual code is:
name: Content Suggestion on: push: branches: - 'main' paths: - '**.md' jobs: make-suggestion: if: github.actor == 'tina-cloud-app[bot]' name: "Make Suggestion" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: tinacms/ai-content@v0 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - name: Create Pull Request id: create-pr uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Automatic PR from ChatGPT" title: "Automatic PR from ChatGPT" body: "A new pull request has been created from ChatGPT" branch: "bot-auto-pr-${{ github.run_number }}" - name: Get list of changed files id: files run: | echo "files=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }})" >> $GITHUB_ENV shell: bash - name: Comment on PR uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const url = `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_REF}/` const changedFiles = process.env.files.split('\n') const markdownFiles = changedFiles.filter(file => file.endsWith('.md')) let commentBody = '' for (const mdFile of markdownFiles) { commentBody += `- [ai fix: ${url}${mdFile}](${url}${mdFile})\n` } await github.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: ${{ steps.create-pr.outputs.pull-request-number }}, body: commentBody })
But it doesn't work because I can't create a PR without changing any file in the branch.
Can I make the tinacms/ai-content@v0 run in every commit without a PR ?
The bot's designed as-is to run on PRs (for the commenting to work). TinaCMS does support a PR-based workflow (although it's currently a business plan feature: https://tina.io/docs/drafts/editorial-workflow/)
I'm trying to run this github action in every new .md file created by tina-cloud-app[bot].
My actual code is:
But it doesn't work because I can't create a PR without changing any file in the branch.
Can I make the tinacms/ai-content@v0 run in every commit without a PR ?