Skip to content

Endless cycle of github actions initiated by a build #74772

Answered by ev1sl
iamshreeram asked this question in Actions
Discussion options

You must be logged in to vote

To prevent a GitHub Actions workflow from triggering itself in an infinite loop, you can use conditional checks within your workflow to determine if the commit was made by a GitHub Actions bot or by another user. If the commit was made by the bot, you can skip the rest of the job.

Here is a common approach using the GITHUB_ACTOR and github.event contexts:

jobs:
  build:
    runs-on: ubuntu-latest
    if: ${{ github.actor != 'github-actions[bot]' && github.event_name != 'push' || github.event.pusher.name != 'github-actions[bot]' }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      # Your other steps...

In this example:

github.actor provides the name of the pe…

Replies: 9 comments 6 replies

Comment options

You must be logged in to vote
3 replies
@09170988219

This comment was marked as off-topic.

@ghost
Comment options

@Jihad85-D
Comment options

Answer selected by iamshreeram
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@assignUser
Comment options

This comment was marked as off-topic.

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Jihad85-D
Comment options

Comment options

You must be logged in to vote
1 reply
@GIgako19929
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Question
10 participants