diff --git a/.github/actions/configure-morpheus-bot/action.yml b/.github/actions/configure-morpheus-bot/action.yml new file mode 100644 index 0000000..bb109ed --- /dev/null +++ b/.github/actions/configure-morpheus-bot/action.yml @@ -0,0 +1,57 @@ +# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Configure Morpheus Bot + + +inputs: + bot-app-id: + description: 'The app id of the bot' + required: true + type: string + bot-private-key: + description: 'The private key of the bot' + required: true + type: string +outputs: + token: + description: 'The token generated for the bot' + value: ${{steps.generate-token.outputs.token }} + +runs: + using: "composite" + steps: + - name: Generate Token + uses: actions/create-github-app-token@v1 + id: generate-token + with: + app-id: ${{ secrets.ACTIONS_APP_ID }} + private-key: ${{ secrets.ACTIONS_APP_KEY }} + - name: Configure Git + run: | + git config -g user.name "morpheus-bot-test[bot]" + git config -g user.email "152534332+morpheus-bot-test[bot]@users.noreply.github.com" + echo "GITHUB_TOKEN=${{ steps.generate-token.outputs.token }}" >> "$GITHUB_ENV" + echo "Git config:" + git config -l --show-origin + echo "Github Auth Info:" + gh auth status + # - name: Checkout + # uses: actions/checkout@v3 + # with: + # path: ${{ env.REPO_NAME }} + # ref: branch-${{ env.CURRENT_VERSION }} + # fetch-depth: 0 # Fetch all history for all tags and branches + # token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/release_procedures.yml b/.github/workflows/release_procedures.yml index 6c4c4e9..40c9402 100644 --- a/.github/workflows/release_procedures.yml +++ b/.github/workflows/release_procedures.yml @@ -109,38 +109,24 @@ jobs: name: Create Next Release Branch runs-on: ubuntu-latest steps: - - name: Generate Token - uses: actions/create-github-app-token@v1 - id: generate-token + - name: Configure Bot + id: configure-bot + uses: ./.github/actions/configure-morpheus-bot with: - # required - app-id: ${{ secrets.ACTIONS_APP_ID }} - private-key: ${{ secrets.ACTIONS_APP_KEY }} + bot-app-id: ${{ secrets.ACTIONS_APP_ID }} + bot-private-key: ${{ secrets.ACTIONS_APP_KEY }} - name: Checkout uses: actions/checkout@v3 with: path: ${{ env.REPO_NAME }} ref: branch-${{ env.CURRENT_VERSION }} fetch-depth: 0 # Fetch all history for all tags and branches - token: ${{ steps.generate-token.outputs.token }} + token: ${{ steps.configure-bot.outputs.token }} - name: Auth info run: | cd ${REPO_NAME} echo "Printing default auth" gh auth status - echo "Printing auth for different token" - GITHUB_TOKEN=${{ steps.generate-token.outputs.token }} gh auth status - echo "GITHUB_TOKEN=${{ steps.generate-token.outputs.token }}" >> "$GITHUB_ENV" - # gh auth refresh - - name: Setup Git user - run: | - cd ${REPO_NAME} - git config user.name "morpheus-bot-test[bot]" - git config user.email "152534332+morpheus-bot-test[bot]@users.noreply.github.com" - # git config url.https://${{ steps.generate-token.outputs.token }}@github.com/.insteadOf https://github.com/ - # gh auth setup-git - echo "Git config:" - git config -l --show-origin - name: Create branch run: | cd ${REPO_NAME}