Skip to content

Commit f9feffc

Browse files
authored
GHA fix: GCP User Roles (#36429)
* Change user roles for testing * Add size check for Terraform plan in PR comments
1 parent 77973ca commit f9feffc

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/beam_Infrastructure_UsersPermissions.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,16 @@ jobs:
7373
- name: Create comment body
7474
if: github.event_name == 'pull_request_target'
7575
run: |
76-
echo "### Terraform Plan for User Roles Changes" > comment_body.txt
77-
echo '```' >> comment_body.txt
78-
cat ./infra/iam/tfplan.txt >> comment_body.txt
79-
echo '```' >> comment_body.txt
76+
PLAN_SIZE=$(wc -c < ./infra/iam/tfplan.txt)
77+
if [ "$PLAN_SIZE" -gt 60000 ]; then
78+
echo "### Terraform Plan for User Roles Changes" > comment_body.txt
79+
echo "Plan is too big, review in Github Action Logs" >> comment_body.txt
80+
else
81+
echo "### Terraform Plan for User Roles Changes" > comment_body.txt
82+
echo '```' >> comment_body.txt
83+
cat ./infra/iam/tfplan.txt >> comment_body.txt
84+
echo '```' >> comment_body.txt
85+
fi
8086
8187
- name: Upload plan as a comment to PR
8288
if: github.event_name == 'pull_request_target'

infra/iam/users.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@
367367
- username: enriquecaol04
368368
email: enriquecaol04@gmail.com
369369
permissions:
370-
- role: projects/apache-beam-testing/roles/beam_viewer
370+
- role: roles/viewer
371371
- username: eventarc-workflow-sa
372372
email: eventarc-workflow-sa@apache-beam-testing.iam.gserviceaccount.com
373373
permissions:

0 commit comments

Comments
 (0)