Skip to content

Commit

Permalink
test unique branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
jjenscodee committed Jan 16, 2024
1 parent 69eab5c commit b41923e
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions .github/workflows/bundle-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Bundle & Push JSON schema

on:
push:
branches:
- main
paths:
- 'schemas/**'
# branches:
# - main
# paths:
# - 'schemas/**'

jobs:
bundle-push-schemas:
Expand All @@ -15,48 +15,48 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v3
- name: Create new branch
id: branch-name
shell: bash
run: |
if git ls-remote origin | grep -sw "ci/update-schemas" 2>&1>/dev/null
then echo "BRANCH EXISTS"
else
git config --global user.name github-actions[bot]
git config --global user.email github-actions[bot]@users.noreply.github.com
git checkout -b ci/update-schemas
git push -u origin ci/update-schemas
fi
- name: Bundle & Push JSON schema for application schemas
uses: ./.github/actions/bundle-schema
with:
schema-path: ./schemas/applications/schema/application.schema.json
schema: application.schema.json
- name: Bundle & Push JSON schema for component-descriptions schemas
uses: ./.github/actions/bundle-schema
with:
schema-path: ./schemas/component-descriptions/schema/component.schema.json
schema: component.schema.json
- name: Bundle & Push JSON schema for controller schemas
uses: ./.github/actions/bundle-schema
with:
schema-path: ./schemas/controller-descriptions/schema/controller.schema.json
schema: controller.schema.json
- name: Checkout branch ci/update-schemas
uses: actions/checkout@v3
with:
ref: ci/update-schemas
- name: Create pull request
shell: bash
run: |
MESSAGE=$(
gh pr create \
-B main \
-H ci/update-schemas \
--title 'ci: update schemas' \
--body 'This PR was automatically created by GitHub actions in response to schema changes. Please review and update any impacted code before merging the changes.' \
--reviewer domire8 \
--reviewer eeberhard \
2>&1
) || echo "::warning::Error creating the PR: $MESSAGE"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

git config --global user.name github-actions[bot]
git config --global user.email github-actions[bot]@users.noreply.github.com
BRANCH_NAME="ci/update-schemas-$(date +%s)"
echo "Generated branch name: $BRANCH_NAME"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
git checkout -b $BRANCH_NAME
git push -u origin $BRANCH_NAME
# - name: Bundle & Push JSON schema for application schemas
# uses: ./.github/actions/bundle-schema
# with:
# schema-path: ./schemas/applications/schema/application.schema.json
# schema: application.schema.json
# - name: Bundle & Push JSON schema for component-descriptions schemas
# uses: ./.github/actions/bundle-schema
# with:
# schema-path: ./schemas/component-descriptions/schema/component.schema.json
# schema: component.schema.json
# - name: Bundle & Push JSON schema for controller schemas
# uses: ./.github/actions/bundle-schema
# with:
# schema-path: ./schemas/controller-descriptions/schema/controller.schema.json
# schema: controller.schema.json
# - name: Checkout branch ci/update-schemas
# uses: actions/checkout@v3
# with:
# ref: ci/update-schemas
# - name: Create pull request
# shell: bash
# run: |
# MESSAGE=$(
# gh pr create \
# -B main \
# -H ci/update-schemas \
# --title 'ci: update schemas' \
# --body 'This PR was automatically created by GitHub actions in response to schema changes. Please review and update any impacted code before merging the changes.' \
# --reviewer domire8 \
# --reviewer eeberhard \
# 2>&1
# ) || echo "::warning::Error creating the PR: $MESSAGE"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#

0 comments on commit b41923e

Please sign in to comment.