-
Notifications
You must be signed in to change notification settings - Fork 287
105 lines (89 loc) · 3.81 KB
/
update-jf-dependencies.yml
File metadata and controls
105 lines (89 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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@v6
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 "action@github.com"
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 build-info-go to latest main branch
- Updated gofrog to latest main branch
- Updated jfrog-cli-core to latest main branch
- Updated jfrog-cli-artifactory to latest main branch
- Updated jfrog-cli-platform-services to latest main branch
- Updated jfrog-cli-security 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
- **gofrog**: Updated to latest main branch
- **jfrog-cli-core**: Updated to latest main branch
- **jfrog-cli-artifactory**: Updated to latest main branch
- **jfrog-cli-platform-services**: Updated to latest main branch
- **jfrog-cli-security**: 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 }}