stefanzweifel / git-auto-commit-action

Automatically commit and push changed files back to GitHub with this GitHub Action for the 80% use case.
MIT License
2.01k stars 228 forks source link

Does not trigger other actions listening to pull request update #274

Closed kjy5 closed 1 year ago

kjy5 commented 1 year ago

git-auto-commit Version

v4.16.0

Machine Type

Ubuntu (eg. ubuntu-latest)

Bug description

Does not trigger pull request synchronize when making commits back to a branch in a pull request.

Example situation:

Steps to reproduce

Have two workflows with triggers

on:
  pull_request:
    types: [opened, synchronize, reopened]

One of these can do whatever, the other will do something that changes the files and later has

- uses: stefanzweifel/git-auto-commit-action@v4

To commit the changes (this works).

The expected behavior is that this commit back to the branch will trigger a rerun of both of these workflows since they trigger on pull request "synchronize".

Tried solutions

Example Workflow

name: Reformat and Lint

on:
  pull_request:
    types: [opened, synchronize, reopened]

  workflow_dispatch:

concurrency:
  group: "reformat-and-lint"
  cancel-in-progress: true

jobs:
  reformat-and-lint:
    runs-on: ubuntu-latest

    steps:
      - name: 🛎 Checkout
        uses: actions/checkout@v3

      - name: 📦 Setup Node.js and caching
        uses: actions/setup-node@v3
        with:
          node-version: 19
          cache: "npm"

      - name: 🔨 Install
        run: npm i

      - name: 🧹 Reformat
        run: npx prettier --write .

      - name: 🚨 Lint
        run: npx eslint .

      - name: ⬆️ Commit changes
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: Reformat and Lint

Relevant log output

No response

stefanzweifel commented 1 year ago

You need to create a personal access token and reference it in the checkout-Action if you want the commit to trigger other workflows.

https://github.com/stefanzweifel/git-auto-commit-action#commits-made-by-this-action-do-not-trigger-new-workflow-runs

kjy5 commented 1 year ago

Ah that was it. Thank you!