Skip to content

Commit

Permalink
Update UpdateGearDependency.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyfilyanin authored Oct 7, 2024
1 parent 588bc3f commit fea4cbf
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/UpdateGearDependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ defaults:
run:
working-directory: scripts

permissions:
contents: write
pull-requests: write

jobs:
update-dependencies:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.UPDATE_GEAR_TAG_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v2
Expand All @@ -32,15 +35,15 @@ jobs:
- name: Check for new tag and update Cargo.toml
env:
GITHUB_TOKEN: ${{ secrets.UPDATE_GEAR_TAG_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python update_gear_version.py
if ! git diff --exit-code; then
echo "Changes detected in the repository after running the update_gear_version.py script."
# Configure git
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Output changes for logging
echo "The following changes were made:"
Expand All @@ -62,13 +65,9 @@ jobs:
echo "Pushing the new branch: $branch_name"
git push origin $branch_name
# Install GitHub CLI
echo "Installing GitHub CLI to create the pull request."
sudo apt-get update && sudo apt-get install gh -y
# Create a pull request using GitHub CLI
echo "Creating a pull request for the new branch: $branch_name"
gh pr create --title "Update GEAR dependencies" --body "Automatically created pull request to update GEAR dependencies" --base master --head $branch_name
GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" gh pr create --title "Update GEAR dependencies" --body "Automatically created pull request to update GEAR dependencies" --base master --head $branch_name
else
echo "No changes were detected after running the update_gear_version.py script."
fi

0 comments on commit fea4cbf

Please sign in to comment.