-
I’m already using Azure Pipelines for builds. I’m now trying GitHub Actions for builds side by side, so I can compare them. I subsequently received a PR for one of my projects from dependabot (gitfool/BoardGameGeek.Dungeon#53). Azure Pipelines only triggered one build, as usual and as expected, but GitHub Actions triggered two builds; one for push and one for pull_request: Is this a bug or do I need to configure the GitHub Actions differently to match Azure Pipelines behaviour? (After merging the pull request there should again be just a single build, but which should not be due to a pull request.) https://github.com/gitfool/BoardGameGeek.Dungeon/blob/master/.azure-pipelines.yml https://github.com/gitfool/BoardGameGeek.Dungeon/blob/master/.github/workflows/build.yml |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hello, your workflow is configured with “on: [push, pull_request]” so it gets triggered twice when a commit is pushed to open a pull request. It looks to me like “on: push” would work well for your use case. |
Beta Was this translation helpful? Give feedback.
-
The devil in the details is that pull requests should not publish build artifacts, whereas pushes / merges to master should, so I need to be able to differentiate pull requests from pushes with the GITHUB environment variables: https://github.com/gitfool/BoardGameGeek.Dungeon/pull/53/checks?check_run_id=228755652#step:6:34 https://github.com/gitfool/BoardGameGeek.Dungeon/pull/53/checks?check_run_id=228755704#step:6:34 Azure Pipelines makes this easy and obvious: |
Beta Was this translation helpful? Give feedback.
-
You can specify the branches that you want builds to run on. WIth the This means that when dependabot creates its branch - in this case,
If you only want to run when something has a pull request opened into master, or when something is merged into master, then you can specify this as:
|
Beta Was this translation helpful? Give feedback.
-
I published https://github.com/marketplace/actions/skip-duplicate-actions to solve this problem in an easy way. |
Beta Was this translation helpful? Give feedback.
You can specify the branches that you want builds to run on. WIth the
on: [push, pull_request]
setting, you’ll get any pushes into _any_ branch, and pull requests into _any_ branch.This means that when dependabot creates its branch - in this case,
dependabot/nuget/Microsoft.NET.Test.Sdk-16.3.0
- that your build will run. It will then run again when it creates the pull request from that branch.If you only want to run when something has a pull request opened into master, or when something is merged into master, then you can specify this as: