@@ -3,7 +3,7 @@ name: "Code formatting"
3
3
on :
4
4
push :
5
5
branches :
6
- - " **"
6
+ - " **"
7
7
8
8
env :
9
9
python_version : " 3.9"
@@ -12,16 +12,25 @@ jobs:
12
12
format-code :
13
13
runs-on : ubuntu-latest
14
14
steps :
15
- - uses : actions/checkout@v4
15
+ - name : Retrieve secrets from Keeper
16
+ id : ksecrets
17
+ uses : Keeper-Security/ksm-action@master
18
+ with :
19
+ keeper-secret-config : ${{ secrets.KSM_CONFIG }}
20
+ secrets : |-
21
+ v2h4jKiZlJywDSoKzRMnRw/field/Access Token > env:PAT # Fetch PAT and store in environment variable
22
+
23
+ - name : Checkout code
24
+ uses : actions/checkout@v4
16
25
with :
17
26
fetch-depth : 0
18
- ssh-key : ${{ secrets.DEPLOY_KEY }}
27
+
19
28
- name : Set up Python ${{ env.python_version }}
20
29
uses : actions/setup-python@v3
21
30
with :
22
31
python-version : ${{ env.python_version }}
23
32
24
- - name : Format modified python files
33
+ - name : Format modified Python files
25
34
env :
26
35
filter : ${{ github.event.before }}
27
36
run : |
@@ -49,12 +58,15 @@ jobs:
49
58
done
50
59
51
60
- name : Commit and push changes
61
+ env :
62
+ PAT : ${{ env.PAT }} # Use PAT fetched from Keeper
52
63
run : |
53
64
HAS_CHANGES=$(git diff --staged --name-only)
54
65
if [ ${#HAS_CHANGES} -gt 0 ]; then
55
66
git config --global user.name mlcommons-bot
56
67
git config --global user.email "[email protected] "
57
68
# Commit changes
58
69
git commit -m '[Automated Commit] Format Codebase'
59
- git push
60
- fi
70
+ # Use the PAT to push changes
71
+ git push https://x-access-token:${PAT}@github.com/${{ github.repository }} HEAD:${{ github.ref_name }}
72
+ fi
0 commit comments