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

chore: fix validations in workflows #1982

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
validate-actor:
# Run only for workflow_dispatch events with a merged pull request
# Run only for workflow_dispatch events
if: github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/validate-actor.yml
secrets:
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/deploy-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ env:

jobs:
validate-actor:
# Run validation for workflow_dispatch with tags
if: >
github.event_name == 'workflow_dispatch' &&
startsWith(github.ref, 'refs/tags/v')
# Run validation for workflow_dispatch
if: github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/validate-actor.yml
secrets:
PAT: ${{ secrets.PAT }}
Expand All @@ -42,7 +40,14 @@ jobs:
# Deploy if validate-actor was successful or skipped
# or if the workflow was invoked by another workflow
if: >
(needs.validate-actor.result == 'success' || needs.validate-actor.result == 'skipped') || inputs.is_called == 'true'
(needs.validate-actor.result == 'success' || needs.validate-actor.result == 'skipped') &&
(
inputs.is_called == 'true' ||
(
github.event_name == 'workflow_dispatch' &&
startsWith(github.ref, 'refs/tags/v')
)
)

steps:
- name: Checkout
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ on:

jobs:
validate-actor:
if: >
github.event_name == 'workflow_dispatch' &&
(
startsWith(github.ref, 'refs/tags/v') ||
startsWith(github.head_ref, 'hotfix-release/') ||
startsWith(github.head_ref, 'release/')
)
if: github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/validate-actor.yml
secrets:
PAT: ${{ secrets.PAT }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-actor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
fi

# Extract the state of the membership
if echo "$response" | grep -q '"state": "active"'; then
if echo "$response" | grep -q '"state":"active"'; then
echo "'$actor' is a member of '@${ORG_NAME}/${TEAM_NAME}' team"
else
echo "Error: '$actor' is NOT a member of '@${ORG_NAME}/${TEAM_NAME}' team. Access denied."
Expand Down
Loading