Skip to content

Commit

Permalink
Merge pull request #4 from balena-io-experimental/kyle/bypass-protect…
Browse files Browse the repository at this point in the history
…ions

Restore versioned source steps
  • Loading branch information
klutchell authored Jan 26, 2024
2 parents 21db2b1 + 4216fe2 commit fe14ae2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/flowzone.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions flowzone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@
GH_TOKEN: ${{ steps.gh_app_token.outputs.token || secrets.FLOWZONE_TOKEN }}
run: |
# Make the API call and get response with headers
full_response=$(gh api "${BRANCH_PROTECTION_URI}" -i --jq .)
full_response=$(gh api "${BRANCH_PROTECTION_URI}" -i --jq . || true)
# Separate headers and body
headers=$(echo "$full_response" | sed -n '/HTTP/{:start /HTTP.*\n.*/{N;b start};p}')
Expand All @@ -557,13 +557,8 @@
# Extract HTTP status code
http_status=$(echo "$headers" | grep HTTP/ | awk '{print $2}')
# Check for non-200 status codes
if [[ "$http_status" != "200" ]]; then
exit 1
fi
message="$(echo "${result}" | jq -r .message)"
if ! [[ $message =~ null ]]
if ! [[ $message =~ null ]] || [[ "$http_status" != "200" ]]
then
case "${message}" in
"Branch not Found"|"Branch not protected")
Expand Down Expand Up @@ -1129,7 +1124,20 @@ jobs:
env:
GITHUB_TOKEN: ${{ steps.gh_app_token.outputs.token || secrets.FLOWZONE_TOKEN }}
run: |
date > now
out="$(balena-versionist 2>&1)"
error="$(awk '/Error:/{getline; print}' <<< "${out}")"
case ${error} in
"") # no error
;;
'No such file or directory'*'/package.json')
echo "::error file=.versionbot/CHANGELOG.yml,line=1::Versionist expects a package.json if repo.yml does not provide a 'type' for the project"
;;
*)
echo "::error::${error}"
exit 1
;;
esac
git status --porcelain
Expand Down Expand Up @@ -1230,7 +1238,7 @@ jobs:
# https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#update-a-reference
- name: Update branch reference
# if: github.event.pull_request.merged == true && steps.create_commit.outputs.sha != ''
if: github.event.pull_request.merged == true && steps.create_commit.outputs.sha != ''
env:
GH_TOKEN: ${{ steps.gh_app_token.outputs.token || secrets.FLOWZONE_TOKEN }}
run: |
Expand Down

0 comments on commit fe14ae2

Please sign in to comment.