Skip to content

Commit e187b75

Browse files
authored
Fix(ci): correct label gate condition to use event.action instead of event_name (#3810)
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 ac73f69 commit e187b75

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
@@ -40,9 +40,11 @@ jobs:
4040
runs-on: ubuntu-latest
4141
if: |
4242
${{ github.actor != 'dependabot[bot]' && (
43+
github.event_name == 'workflow_dispatch' ||
44+
github.event_name == 'push' ||
4345
github.event.pull_request.author_association == 'OWNER' ||
4446
github.event.pull_request.author_association == 'COLLABORATOR' ||
45-
(github.event_name == 'labeled' &&
47+
(github.event.action == 'labeled' &&
4648
github.event.label.name == 'safe-to-test')
4749
) }}
4850
outputs:
@@ -56,6 +58,9 @@ jobs:
5658
elif [[ "${{ github.event_name }}" == "push" ]]; then
5759
echo "checkout push request ${{github.event.push.after}}"
5860
echo "ref=${{github.event.push.after}}" >> $GITHUB_OUTPUT
61+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
62+
echo "checkout workflow_dispatch ref ${{ github.sha }}"
63+
echo "ref=${{ github.sha }}" >> $GITHUB_OUTPUT
5964
else
6065
echo "checkout else ${{ github.event.workflow_run.head_sha }}"
6166
echo "ref=${{github.event.workflow_run.head_sha}}" >> $GITHUB_OUTPUT
@@ -97,7 +102,7 @@ jobs:
97102
- create-cf-env
98103
outputs:
99104
env-name: ${{ steps.set-name.outputs.env-name }}
100-
if: ${{ always() && github.actor != 'dependabot[bot]' }}
105+
if: ${{ always() && needs.get-sha.result == 'success' && github.actor != 'dependabot[bot]' }}
101106
steps:
102107
- name: set env name
103108
id: set-name

0 commit comments

Comments
 (0)