Skip to content

Commit 0c8d23f

Browse files
authored
Sync Action into Veracode
1 parent ce6ac76 commit 0c8d23f

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/syncAction.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Sync Action into Veracode
2+
on:
3+
push:
4+
tags:
5+
- v**
6+
7+
jobs:
8+
sync:
9+
runs-on: ubuntu-latest
10+
name: Sync IAC Scan Repo
11+
12+
steps:
13+
- name: Checkout iac-scan repo
14+
uses: actions/checkout@v4
15+
with:
16+
path: iac-scan
17+
18+
- name: Checkout ghes-actions-integration repo
19+
uses: actions/checkout@v4
20+
with:
21+
repository: veracode/ghes-actions-integration
22+
token: ${{ secrets.PAT_TOKEN }}
23+
path: ghes-actions-integration
24+
persist-credentials: false
25+
26+
- name: Copy dist and action.yml files
27+
run: |
28+
cp -r iac-scan/dist ghes-actions-integration/actions/iac-scan/
29+
cp iac-scan/action.yml ghes-actions-integration/actions/iac-scan/
30+
31+
- name: Create branch and push changes
32+
run: |
33+
cd ghes-actions-integration
34+
git config user.name "veracode"
35+
git config user.email "[email protected]"
36+
BRANCH_NAME="sync-iac-scan-$(date +%s)"
37+
git checkout -b $BRANCH_NAME
38+
git add actions
39+
40+
# Only commit and push if there are changes
41+
if ! git diff --cached --quiet; then
42+
git commit -m "Sync IAC Scan dist and action.yml"
43+
git push <https://x-access-token:${{> secrets.PAT_TOKEN }}@github.com/veracode/ghes-actions-integration.git $BRANCH_NAME
44+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
45+
echo "CHANGES_MADE=true" >> $GITHUB_ENV
46+
else
47+
echo "No changes to commit"
48+
echo "CHANGES_MADE=false" >> $GITHUB_ENV
49+
fi
50+
51+
- name: Create Pull Request with GitHub CLI
52+
if: env.CHANGES_MADE == 'true'
53+
run: |
54+
gh pr create \\
55+
--repo veracode/ghes-actions-integration \\
56+
--base main \\
57+
--head ${{ env.BRANCH_NAME }} \\
58+
--title "Sync latest changes from iac-scan repository" \\
59+
--body "Sync from iac-scan repository
60+
61+
- Updated dist folder
62+
- Updated action.yml file"
63+
env:
64+
GH_TOKEN: ${{ secrets.PAT_TOKEN }}

0 commit comments

Comments
 (0)