From f020d28bd912dfda152416a3b262036d07e55019 Mon Sep 17 00:00:00 2001 From: Cameron Steele Date: Sun, 10 Sep 2023 18:40:00 -0500 Subject: [PATCH] Install GH cli to make PR --- .github/workflows/docker-publish.yml | 29 ++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 69bece3..9f677da 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -103,14 +103,31 @@ jobs: awk -v new_image="$NEW_IMAGE" 'BEGIN {OFS=FS} /^image =/ {$0=new_image} {print}' gitops/containers/gliderbot/gliderbot.toml > gitops/containers/gliderbot/gliderbot.toml.tmp mv gitops/containers/gliderbot/gliderbot.toml.tmp gitops/containers/gliderbot/gliderbot.toml - # Commit and create a pull request - - name: Commit changes and create a pull request + # Install GitHub CLI + - name: Install GitHub CLI + run: | + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 + sudo apt-add-repository https://cli.github.com/packages + sudo apt update + sudo apt install gh + + # Configure GitHub CLI + - name: Configure GitHub CLI + run: gh auth login --with-token ${{ secrets.ACCESS_TOKEN }} + + # Create a new branch and commit changes + - name: Create a new branch and commit changes run: | cd gitops - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git config --global user.name "github-actions[bot]" + git config user.name "GitHub Actions" + git config user.email "actions@github.com" git checkout -b update-gliderbot-image - git add containers/gliderbot/gliderbot.toml + git add -A git commit -m "Update Gliderbot image" git push origin update-gliderbot-image - gh pr create --base main --head update-gliderbot-image --title "Update Gliderbot image" --body "Automated update of Gliderbot image." + + # Create Pull Request + - name: Create Pull Request + run: | + cd gitops + gh pr create --base main --head update-gliderbot-image --title "Update Gliderbot image" --body "Automated PR to update the Gliderbot image."