Skip to content

Commit f1b9257

Browse files
committed
Fix(ci): correct label gate condition to use event.action instead of event_name
github.event_name is always 'pull_request_target' for all PR trigger types. The action type (labeled, synchronize, etc.) is exposed via github.event.action, so the safe-to-test label check was never evaluating to true Signed-off-by: Prem Kumar Kalle <prem.kalle@broadcom.com>
1 parent d9741b8 commit f1b9257

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/remove-safe-to-test-label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
if: contains(github.event.pull_request.labels.*.name, 'safe-to-test')
1717
steps:
1818
- name: Remove safe-to-test label
19-
run: gh pr edit "${{ github.event.pull_request.number }}" --remove-label "safe-to-test"
19+
run: gh pr edit "${{ github.event.pull_request.number }}" --remove-label "safe-to-test" --repo "${{ github.repository }}"
2020
env:
2121
GH_TOKEN: ${{ github.token }}

.github/workflows/tests-integration.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ jobs:
4141
runs-on: ubuntu-latest
4242
if: |
4343
${{ github.actor != 'dependabot[bot]' && (
44+
github.event_name == 'workflow_dispatch' ||
45+
github.event_name == 'push' ||
4446
github.event.pull_request.author_association == 'OWNER' ||
4547
github.event.pull_request.author_association == 'COLLABORATOR' ||
46-
(github.event_name == 'labeled' &&
48+
(github.event.action == 'labeled' &&
4749
github.event.label.name == 'safe-to-test')
4850
) }}
4951
outputs:
@@ -57,6 +59,9 @@ jobs:
5759
elif [[ "${{ github.event_name }}" == "push" ]]; then
5860
echo "checkout push request ${{github.event.push.after}}"
5961
echo "ref=${{github.event.push.after}}" >> $GITHUB_OUTPUT
62+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
63+
echo "checkout workflow_dispatch ref ${{ github.sha }}"
64+
echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
6065
else
6166
echo "checkout else ${{ github.event.workflow_run.head_sha }}"
6267
echo "ref=${{github.event.workflow_run.head_sha}}" >> $GITHUB_OUTPUT
@@ -98,7 +103,7 @@ jobs:
98103
- create-cf-env
99104
outputs:
100105
env-name: ${{ steps.set-name.outputs.env-name }}
101-
if: ${{ always() && github.actor != 'dependabot[bot]' }}
106+
if: ${{ always() && needs.get-sha.result == 'success' && github.actor != 'dependabot[bot]' }}
102107
steps:
103108
- name: set env name
104109
id: set-name

0 commit comments

Comments
 (0)