1111 description : ' Branch to publish development releases'
1212 required : false
1313 type : string
14+ jira_ticket :
15+ description : ' Jira ticket ID (e.g. AST-12345)'
16+ required : true
17+ type : string
1418 workflow_dispatch :
1519 inputs :
1620 tag :
2125 description : ' Branch to publish development releases'
2226 required : false
2327 type : string
28+ jira_ticket :
29+ description : ' Jira ticket ID (e.g. AST-12345)'
30+ required : true
31+ type : string
2432
2533jobs :
2634 deleteDevReleases :
@@ -118,23 +126,17 @@ jobs:
118126 git add .gitattributes
119127 git commit -m "Ensure LFS tracking for large JAR files" || echo "No changes to commit"
120128
121- - name : Clone target repository and push changes
129+ - name : Clone target repository and push changes via PR
130+ env :
131+ GH_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
122132 run : |
123- # Clone the repository
124133 git clone https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git update-site
125134 cd update-site
126-
127- # Ensure Git LFS is installed
128135 git lfs install
129-
130- # Configure Git user to prevent commit errors
131136 git config --global user.email "cylon-bot@checkmarx.com"
132137 git config --global user.name "cylon-bot"
133-
134- # Fetch all branches
135138 git fetch --all
136139
137- # Ensure the branch exists and check it out
138140 if git show-ref --verify --quiet refs/remotes/origin/${{ env.GH_BRANCH_NAME }}; then
139141 echo "Branch ${{ env.GH_BRANCH_NAME }} exists remotely."
140142 git checkout -B ${{ env.GH_BRANCH_NAME }} origin/${{ env.GH_BRANCH_NAME }}
@@ -143,36 +145,48 @@ jobs:
143145 exit 1
144146 fi
145147
146- # Debugging: List files in repository before copying
147- echo "===== Files in com.checkmarx.eclipse.site/target/repository/ BEFORE COPY ====="
148+ # Create a feature branch
149+ FEATURE_BRANCH="update-site/${{ env.GH_RELEASE_TAG_NAME }}"
150+ git checkout -b "$FEATURE_BRANCH"
151+
152+ echo "===== Files BEFORE COPY ====="
148153 ls -lh ../com.checkmarx.eclipse.site/target/repository/
149154
150- # Copy new files without deleting .git directory
151155 rsync -av --delete --exclude='.git' ../com.checkmarx.eclipse.site/target/repository/ ./
152156
153- # Debugging: List files in repository after copying
154- echo "===== Files in update-site/ AFTER COPY ====="
157+ echo "===== Files AFTER COPY ====="
155158 ls -lh .
156159
157- # Dynamically track all .jar files in the plugins/ and features/ directories
158160 find plugins -name "*.jar" -exec git lfs track {} +
159161 find features -name "*.jar" -exec git lfs track {} +
160162
161- # Ensure .gitattributes is added
162163 git add .gitattributes
163164 git add .
164165
165- # Debugging: Show LFS-tracked files
166166 echo "===== Git LFS-tracked files ====="
167167 git lfs ls-files
168168
169- git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }}" || echo "No changes to commit"
169+ git commit -m "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }}) " || echo "No changes to commit"
170170
171- # Ensure the correct remote URL
172171 git remote set-url origin https://x-access-token:${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/CheckmarxDev/ast-eclipse-plugin-update-site.git
173172
174- # Push changes
175- git push origin ${{ env.GH_BRANCH_NAME }}
173+ # Push the feature branch
174+ git push origin "$FEATURE_BRANCH"
175+
176+ # Create PR with Jira ID at the end of the title
177+ gh pr create \
178+ --repo CheckmarxDev/ast-eclipse-plugin-update-site \
179+ --base "${{ env.GH_BRANCH_NAME }}" \
180+ --head "$FEATURE_BRANCH" \
181+ --title "Update Eclipse update site for ${{ env.GH_RELEASE_TAG_NAME }} (${{ inputs.jira_ticket }})" \
182+ --body "Automated update of Eclipse update site for release ${{ env.GH_RELEASE_TAG_NAME }}."
183+
184+ # Squash and merge the PR, then delete the branch
185+ gh pr merge \
186+ --repo CheckmarxDev/ast-eclipse-plugin-update-site \
187+ --squash \
188+ --auto \
189+ --delete-branch
176190
177191
178192
0 commit comments