This is the first workflow I'm writing with Github Actions, I am using this worfklow combined with AWS CodeDeploy to automate deployment.
# .github/workflows/deployment.yml
on:
push:
branches:
- Production
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: //AWS_ACCESS_KEY_ID
aws-secret-access-key: //AWS_SECRET_KEY
aws-region: // region
- uses: actions/checkout@v2
- id: deploy
uses: webfactory/[email protected]
- uses: peter-evans/commit-comment@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
body: |
@${{ github.actor }} this was deployed as [${{ steps.deploy.outputs.deploymentId }}](https://console.aws.amazon.com/codesuite/codedeploy/deployments/${{ steps.deploy.outputs.deploymentId }}?region=eu-central-1) to group `${{ steps.deploy.outputs.deploymentGroupName }}`.
Everything is working perfectly when I push new commits to the branch "Production" but the problem is that with every new pull request to merge feature branches into the "dev" branch , Github runs checks on the pull requests and executes the workflow, which is not needed or written in its code.
- '!dev'to prevent the workflow to trigger on this specific branch. There is abranches-ignoreoption as well (reference: docs.github.com/en/actions/reference/…) - GuiFalourd