13
13
required : true
14
14
default : ' main'
15
15
16
+ permissions :
17
+ contents : write
18
+ pull-requests : write
19
+ id-token : write
20
+
16
21
jobs :
17
22
update-the-dependency :
18
23
runs-on : ubuntu-latest
@@ -22,23 +27,26 @@ jobs:
22
27
with :
23
28
workload_identity_provider : ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
24
29
service_account : ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}
25
- - name : Fetch the Git Credentials
30
+ - name : Get Secret Manager Secrets
26
31
id : secrets
27
32
uses : ' google-github-actions/get-secretmanager-secrets@v2'
28
33
with :
29
34
secrets : |-
30
- github_credentials:aptos-ci/GIT_CREDENTIALS
31
- - name : Setup git credentials
32
- shell : bash
35
+ token:aptos-ci/github-actions-repository-dispatch
36
+ - name : Configure Git user
33
37
run : |
34
- git config --global credential.helper store
35
- echo "${{ steps.secrets.outputs.github_credentials }}" > ~/.git-credentials
38
+ git config --global user.name "Aptos Bot"
39
+ git config --global user.email "[email protected] "
36
40
- name : Checkout
37
41
uses : actions/checkout@v4
42
+ with :
43
+ token : ${{ steps.secrets.outputs.token }}
38
44
- name : Setup Rust
39
45
uses : actions-rust-lang/setup-rust-toolchain@v1
46
+
40
47
- name : Install toml
41
48
run : cargo install toml-cli
49
+
42
50
- name : Update the dependency
43
51
run : |
44
52
set -e
@@ -53,25 +61,30 @@ jobs:
53
61
git add Cargo.toml
54
62
git commit -m "Update aptos-protos to ${{ github.event.inputs.commit_hash || github.event.client_payload.commit_hash }}"
55
63
git push origin "$branch_name" --force
64
+ env :
65
+ GITHUB_TOKEN : ${{ steps.secrets.outputs.token }}
56
66
working-directory : aptos-indexer-processors-sdk/
67
+
57
68
- name : Check if PR Already Exists
58
69
id : check_pr
59
70
run : |
60
- branch_name="${{ github.event.client_payload.branch_name }}-update-aptos-protos"
71
+ branch_name="${{ github.event.inputs.branch_name || github.event. client_payload.branch_name }}-update-aptos-protos"
61
72
existing_pr=$(gh pr list --base main --head "$branch_name" --json number --jq '.[].number')
62
73
if [ -n "$existing_pr" ]; then
63
74
echo "::set-output name=if_pr_exists::true"
64
75
else
65
76
echo "::set-output name=if_pr_exists::false"
66
77
fi
67
78
env :
68
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
79
+ GITHUB_TOKEN : ${{ steps. secrets.outputs.token }}
69
80
- name : Create Pull Request
70
81
if : steps.check_pr.outputs.if_pr_exists == 'false'
71
82
run : |
72
- branch_name="${{ github.event.client_payload.branch_name }}-update-aptos-protos"
83
+ branch_name="${{ github.event.inputs.branch_name || github.event. client_payload.branch_name }}-update-aptos-protos"
73
84
gh pr create --title "Update aptos-protos to upstream branch ${{ github.event.client_payload.branch_name }}" \
74
85
--body "This PR updates aptos-protos to new version." \
75
86
--base main \
76
87
--head "$branch_name" \
77
88
--label "indexer-sdk-update"
89
+ env :
90
+ GITHUB_TOKEN : ${{ steps.secrets.outputs.token }}
0 commit comments