allow for tests to run for dependabot without need for label

This commit is contained in:
zinduolis
2026-03-06 10:27:36 +10:00
parent 997a2e0a9e
commit b8f96bfae5

View File

@@ -3,27 +3,38 @@ name: 'BrowserStack Test'
on: on:
pull_request_target: pull_request_target:
branches: [ master ] branches: [ master ]
types: [ labeled ] types: [ labeled, opened, synchronize ]
jobs: jobs:
ubuntu-job: ubuntu-job:
name: 'BrowserStack Test on Ubuntu' name: 'BrowserStack Test on Ubuntu'
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.label.name == 'safe_to_test' if: |
github.event.label.name == 'safe_to_test' ||
github.event.pull_request.user.login == 'dependabot[bot]'
env: env:
GITACTIONS: true GITACTIONS: true
steps: steps:
- name: 'Remove safe_to_test label' - name: 'Remove safe_to_test label'
if: github.event.label.name == 'safe_to_test'
uses: actions/github-script@v8 uses: actions/github-script@v8
with: with:
script: | script: |
await github.rest.issues.removeLabel({ try {
owner: context.repo.owner, await github.rest.issues.removeLabel({
repo: context.repo.repo, owner: context.repo.owner,
issue_number: context.payload.pull_request.number, repo: context.repo.repo,
name: 'safe_to_test' issue_number: context.payload.pull_request.number,
}); name: 'safe_to_test'
});
} catch (e) {
if (e.status === 404) {
console.log('Label already removed, skipping');
} else {
throw e;
}
}
- name: 'BrowserStack Env Setup' # Invokes the setup-env action - name: 'BrowserStack Env Setup' # Invokes the setup-env action
uses: browserstack/github-actions/setup-env@master uses: browserstack/github-actions/setup-env@master