77 - master
88 paths :
99 # Trigger when any of these files in AWS-S3 directory change
10- - ' DataConnectors/AWS-S3/*.ps1'
11- - ' DataConnectors/AWS-S3/*.py'
12- - ' DataConnectors/AWS-S3/*.md'
13- - ' DataConnectors/AWS-S3/CloudFormation/**'
14- - ' DataConnectors/AWS-S3/Enviornment/**'
15- - ' DataConnectors/AWS-S3/Utils/**'
10+ - " DataConnectors/AWS-S3/*.ps1"
11+ - " DataConnectors/AWS-S3/*.py"
12+ - " DataConnectors/AWS-S3/*.md"
13+ - " DataConnectors/AWS-S3/CloudFormation/**"
14+ - " DataConnectors/AWS-S3/Enviornment/**"
15+ - " DataConnectors/AWS-S3/Utils/**"
1616 # Don't trigger on zip file changes (to avoid recursion)
17- - ' !DataConnectors/AWS-S3/*.zip'
17+ - " !DataConnectors/AWS-S3/*.zip"
1818 # Don't trigger on bundle automation documentation changes (not bundled)
19- - ' !DataConnectors/AWS-S3/BUNDLE_AUTOMATION.md'
20-
19+ - " !DataConnectors/AWS-S3/BUNDLE_AUTOMATION.md"
20+
2121 # Allow manual workflow dispatch for testing
2222 workflow_dispatch :
2323
@@ -29,35 +29,35 @@ jobs:
2929 permissions :
3030 contents : write
3131 pull-requests : write
32-
32+
3333 steps :
3434 - name : Generate a token
3535 id : generate_token
3636 uses : actions/create-github-app-token@v1
3737 with :
3838 app-id : ${{ secrets.APPLICATION_ID }}
3939 private-key : ${{ secrets.APPLICATION_PRIVATE_KEY }}
40-
40+
4141 - name : Checkout PR branch with sparse checkout
4242 uses : actions/checkout@v4
4343 with :
4444 token : ${{ steps.generate_token.outputs.token }}
4545 ref : ${{ github.event.pull_request.head.ref }}
46- fetch-depth : 2 # Just need HEAD and parent for git diff
47- persist-credentials : false # Security: Don't persist credentials after checkout
46+ fetch-depth : 2 # Just need HEAD and parent for git diff
47+ persist-credentials : false # Security: Don't persist credentials after checkout
4848 sparse-checkout : |
4949 DataConnectors/AWS-S3
5050 .script
5151 sparse-checkout-cone-mode : false
52-
52+
5353 - name : Restore bundling script from base branch
5454 run : |
5555 # Security: Use trusted script from base branch to prevent malicious PR modifications
5656 # Fetch the base branch to ensure we have the reference
5757 git fetch origin ${{ github.base_ref || 'master' }}:refs/remotes/origin/${{ github.base_ref || 'master' }}
5858 git checkout origin/${{ github.base_ref || 'master' }} -- .script/bundleAwsS3Scripts.sh
5959 chmod +x .script/bundleAwsS3Scripts.sh
60-
60+
6161 - name : Check if auto-update needed
6262 id : check_update
6363 run : |
@@ -68,26 +68,27 @@ jobs:
6868 else
6969 echo "skip=false" >> $GITHUB_OUTPUT
7070 fi
71-
71+
7272 - name : Update bundles
7373 if : steps.check_update.outputs.skip != 'true'
7474 run : |
7575 .script/bundleAwsS3Scripts.sh
76-
76+
7777 - name : Commit updated bundles
7878 if : steps.check_update.outputs.skip != 'true'
7979 env :
8080 GITHUB_TOKEN : ${{ steps.generate_token.outputs.token }}
81+ PR_HEAD_REF : ${{ github.event.pull_request.head.ref }}
8182 run : |
8283 git config --local user.email "action@github.com"
8384 git config --local user.name "GitHub Action"
84-
85+
8586 # Configure remote with token for push (needed due to persist-credentials: false)
8687 git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
87-
88+
8889 # Stage zip files
8990 git add DataConnectors/AWS-S3/ConfigAwsS3DataConnectorScripts*.zip
90-
91+
9192 # Check if there are changes to commit
9293 if ! git diff --cached --quiet; then
9394 git commit -m "Auto-update AWS-S3 DataConnector bundles
9899
99100 [skip ci]"
100101
101- git push origin ${{ github.event.pull_request.head.ref }}
102+ git push origin "$PR_HEAD_REF"
102103
103104 echo "✅ Successfully updated and committed bundle files"
104105 else
0 commit comments