Update JFrog Dependencies #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update JFrog Dependencies | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-dependencies: | |
| name: Update JFrog Dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate timestamp | |
| id: timestamp | |
| run: echo "timestamp=$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT | |
| - name: Checkout main branch | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: master | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create and checkout new branch | |
| id: branch | |
| run: | | |
| BRANCH_NAME="use-latest-jf-dependencies-${{ steps.timestamp.outputs.timestamp }}" | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "github-actions[bot]" | |
| git checkout -b "$BRANCH_NAME" | |
| echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
| - name: Run make update-all | |
| run: make update-all | |
| - name: Check for changes and commit | |
| id: changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| git add . | |
| git commit -m "Update JFrog dependencies to latest versions | |
| - Updated archiver to latest version | |
| - Updated client-go to latest main branch | |
| - Updated gofrog to latest main branch | |
| - Ran go mod tidy to clean up dependencies | |
| Generated by workflow: ${{ github.workflow }}" | |
| git push origin "${{ steps.branch.outputs.branch_name }}" | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected, skipping PR creation" | |
| fi | |
| - name: Create Pull Request | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| gh pr create \ | |
| --title "Update JFrog dependencies to latest versions" \ | |
| --body "This PR updates all JFrog dependencies to their latest versions: | |
| - **build-info-go**: Updated to latest main branch | |
| - **client-go**: Updated to latest main branch | |
| - **gofrog**: Updated to latest main branch | |
| - **go.mod**: Cleaned up with \`go mod tidy\` | |
| Generated automatically by workflow: \`${{ github.workflow }}\` | |
| **Branch**: \`${{ steps.branch.outputs.branch_name }}\` | |
| **Timestamp**: \`${{ steps.timestamp.outputs.timestamp }}\`" \ | |
| --base master \ | |
| --head "${{ steps.branch.outputs.branch_name }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.CLI_ACTION_TOKEN }} | |
| - name: Get PR number | |
| if: steps.changes.outputs.has_changes == 'true' | |
| id: pr_number | |
| run: | | |
| PR_NUMBER=$(gh pr list --head "${{ steps.branch.outputs.branch_name }}" --json number --jq '.[0].number') | |
| echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT | |
| env: | |
| GH_TOKEN: ${{ secrets.CLI_ACTION_TOKEN }} | |
| - name: Approve Pull Request | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| gh pr review --approve "${{ steps.pr_number.outputs.pr_number }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.CLI_ACTION_TOKEN }} | |
| - name: Enable auto-merge | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| gh pr merge --auto --squash "${{ steps.pr_number.outputs.pr_number }}" | |
| env: | |
| GH_TOKEN: ${{ secrets.CLI_ACTION_TOKEN }} |