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: 14 comments 15 replies

Comment options

You must be logged in to vote
7 replies
@Jihad85-D
Comment options

@thotie1993
Comment options

@smitovich
Comment options

@thotie1993
Comment options

@MindFireGPSDevEleSearch
Comment options

Answer selected by iamshreeram
Comment options

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

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
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@MindFireGPSDevEleSearch
Comment options

@MindFireGPSDevEleSearch
Comment options

@MindFireGPSDevEleSearch
Comment options

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

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