microsoft / AL-Go

The plug-and-play DevOps solution for Business Central app development on GitHub
MIT License
253 stars 115 forks source link

Automatic updates for AL-Go are failing #1084

Closed nemanja899 closed 1 month ago

nemanja899 commented 1 month ago

I get this error when automatic updates are sheduled, I get and error as seen below.

Error: Unexpected error when running action. Error Message: Failed to update AL-Go System Files. Make sure that the personal access token, defined in the secret called GhTokenWorkflow, is not expired and it has permission to update workflows. (Error was remote: error: GH013: Repository rule violations found for refs/heads/main. remote: Review all repository rules at http://github.com/NPSBeograd/Business-Central-Localization/rules?ref=refs%2Fheads%2Fmain remote: remote: - Changes must be made through a pull request. remote: remote: - Required status check "Pull Request Status Check" is expected. remote: To https://github.com/NPSBeograd/Business-Central-Localization ! [remote rejected] main -> main (push declined due to repository rule violations) error: failed to push some refs to 'https://github.com/NPSBeograd/Business-Central-Localization' ExitCode: 1 Commandline: git push ***github.com/NPSBeograd/Business-Central-Localization ), StackTrace: at <ScriptBlock>, D:\a\_actions\microsoft\AL-Go-Actions\v4.1\CheckForUpdates\CheckForUpdates.ps1: line 257 <- at <ScriptBlock>, D:\a\_temp\3ba9509c-8200-4816-aece-0dae26061500.ps1: line 4 <- at <ScriptBlock>, <No file>: line 1

image Settings on repository level image Settings on organization level image

freddydk commented 1 month ago

what version of AL-Go are you using? v5.1 or preview?

nemanja899 commented 1 month ago

On this repository v4.1

nemanja899 commented 1 month ago

This when automatic updates started failing image

freddydk commented 1 month ago

It probably started failing when you setup the repository to require Pull Requests (direct commits are not allowed). Currently Update AL-Go System Files running on a schedule will always do direct commits - but I will investigate what it takes to have it create a PR instead.

nemanja899 commented 1 month ago

But we always had that setup for main branch. It was working before. Thought that was the use of ghworkflowtoken to aprove PRs automatically.

Thanks @freddydk.

freddydk commented 1 month ago

But we always had that setup for main branch. It was working before. Thought that was the use of ghworkflowtoken to aprove PRs automatically.

Thanks @freddydk.

Did some testing and if you remove this setting in branch protection: image

then Update AL-Go Settings Files will actually bypass your branch protection. Did you maybe change this setting at some point in time last month?

nemanja899 commented 1 month ago

But we always had that setup for main branch. It was working before. Thought that was the use of ghworkflowtoken to aprove PRs automatically. Thanks @freddydk.

Did some testing and if you remove this setting in branch protection: image

then Update AL-Go Settings Files will actually bypass your branch protection. Did you maybe change this setting at some point in time last month?

We didn't it was always like this, and I apologize checked workflows it was passing because it has nothing to update with.

freddydk commented 1 month ago

Thanks - we will be changing the functionality to automatically create a PR if it cannot update using a direct commit - this will allow scheduled updates to run the way you want.

nemanja899 commented 1 month ago

Thanks - we will be changing the functionality to automatically create a PR if it cannot update using a direct commit - this will allow scheduled updates to run the way you want.

Thank you that would be extremely helpful.