Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix workflow permission check logic #4084

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1397,7 +1397,6 @@ workflows:
jobs:
- release-train


daily-loadshedder-integration-tests:
when:
and:
Expand Down Expand Up @@ -1425,7 +1424,9 @@ workflows:
- equal:
- "run-manual-tests"
- << pipeline.parameters.action >>
- equal: [ "run-from-github-comments", << pipeline.parameters.GHA_Event >>]
- equal:
- "run-from-github-comments"
- << pipeline.parameters.GHA_Meta >>
jobs:
- backend-integration-tests-SK1
- backend-integration-tests-SK2
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/trigger_all_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ jobs:

tonidero marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Check membership in RevenueCat Org
env:
READ_ORG_GITHUB_TOKEN: ${{ secrets.READ_ORG_GITHUB_TOKEN }}
id: verify
# ensure that only RevenueCat members can trigger this
run: |
RESPONSE=$(curl https://api.github.com/orgs/RevenueCat/members/${{ github.event.comment.user.login }})
if [[ "$RESPONSE" == *"Not Found"* ]]; then
RESPONSE=$(curl -s -o /dev/null --head -w "%{http_code}" -H "Authorization: Bearer $READ_ORG_GITHUB_TOKEN" https://api.github.com/orgs/RevenueCat/members/${{ github.event.comment.user.login }})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably add a comment and maybe use \ to split this up into lines for clarity

if [[ "$RESPONSE" != "204" ]]; then
echo "User is not a member of the organization"
exit 1
fi
Expand All @@ -29,6 +31,6 @@ jobs:

uses: CircleCI-Public/[email protected]
with:
GHA_Action: "run-from-github-comments"
GHA_Meta: "run-from-github-comments"
env:
CCI_TOKEN: ${{ secrets.CIRCLECI_TOKEN }}