github / branch-deploy

Enabling Branch Deployments through IssueOps with GitHub Actions - If you find this project useful, give it a star! ⭐️
https://github.com/marketplace/actions/branch-deploy
MIT License
364 stars 44 forks source link

Deploy not occurring due to out-of-date branch when `update_branch` is set to `disable` #292

Closed daczarne closed 1 month ago

daczarne commented 1 month ago

Describe the Issue

I have a repository where we are using this action to deploy GitHub envs to dev for testing (different teams have different environments for themselves, in this case ours is called qcommerce). We have therefore set the update_branch to disable. Yet, deployments get blocked due to "branch being out of date with main".

image

Action Configuration

- name: Deploy branch 🚀
  id: deploy_branch
  uses: github/branch-deploy@v9.4.0
  with:
    trigger: .deploy
    reaction: rocket
    environment: qcommerce
    environment_targets: qcommerce
    draft_permitted_targets: qcommerce
    stable_branch: main
    update_branch: disable
    skip_ci: qcommerce
    skip_reviews: qcommerce

Relevant Actions Log Output

Action displayed by the action on the runner (we are using GitHub runners, not self-hosted).

Run github/branch-deploy@v9.4.0
  with:
    trigger: .deploy
    reaction: rocket
    environment: qcommerce
    environment_targets: qcommerce
    draft_permitted_targets: qcommerce
    update_branch: disable
    skip_ci: qcommerce
    skip_reviews: qcommerce
    github_token: ***
    status: success
    environment_url_in_comment: true
    production_environments: production
    noop_trigger: .noop
    lock_trigger: .lock
    unlock_trigger: .unlock
    help_trigger: .help
    lock_info_alias: .wcid
    permissions: write,maintain,admin
    param_separator: |
    global_lock_flag: --global
    stable_branch: main
    outdated_mode: strict
    required_contexts: false
    checks: all
    allow_forks: true
    admins: false
    admins_pat: false
    merge_deploy_mode: false
    unlock_on_merge_mode: false
    skip_completing: false
    deploy_message_path: .github/deployment_message.md
    sticky_locks: false
    sticky_locks_for_noop: false
    allow_sha_deployments: false
    disable_naked_commands: false
    skip_successful_noop_labels_if_approved: false
    skip_successful_deploy_labels_if_approved: false
✅ comment body starts with trigger: .deploy
🌍 environment: qcommerce
📓 deployment requested on a draft pull request from an allowed environment
⏩ CI checks have been disabled for the qcommerce environment
Warning: The PR branch is behind the base branch by 3 commits
Warning: The PR branch is behind the base branch by 3 commits
Error: ### ⚠️ Cannot proceed with deployment

- mergeStateStatus: `BLOCKED`
- update_branch: `disable`

> I went ahead and updated your branch with `main` - Please try again once this operation is complete

Extra Information

Once we update the branch and re-trigger the workflow, the error goes away (as expected). But we want to avoid this, as this is a mono-repo and we are deploying to a dev env for testing anyways.

GrantBirki commented 1 month ago

@daczarne I think I figured out what your issue is 😉

Instead of update_branch: disable you'll want it to be disabled (with a d at the end). I think its just that minor typo and then you should be good.

This actually makes me think that I should potentially add some code into this project that validates inputs. So you have a typo in an input it will alert you that the option is not valid.

GrantBirki commented 1 month ago

The pre-release v9.6.0 now contains some basic input validation to help catch things like simple typos to help avoid confusion like this in the future 😃

daczarne commented 1 month ago

Epic fail on my side 🫤 ... and I spent a good two/three hours going over the docs because of this.

Thanks @GrantBirki!!