Skip to content

Commit fcacbbb

Browse files
authored
ci: add dispatch bct step (#1060)
- Add dispatch step to BCT workflow
1 parent e769147 commit fcacbbb

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

.github/workflows/bct.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,34 @@ jobs:
77
runs-on: ubuntu-latest
88
if: github.event.issue.pull_request && contains(github.event.comment.body, 'Deploy Preview for') && contains(github.event.comment.body, 'ready!')
99
steps:
10-
- uses: actions/checkout@v3
11-
- name: Extract repository name
12-
id: repo_name
13-
run: echo "::set-output name=repo::$(echo ${{ github.repository }} | cut -d'/' -f2)"
14-
- run: echo "https://deploy-preview-${{ github.event.issue.number }}--${{ steps.repo_name.outputs.repo }}.netlify.app"
15-
- name: Dump GitHub context
16-
env:
17-
GITHUB_CONTEXT: ${{ toJson(github) }}
18-
run: echo "$GITHUB_CONTEXT"
19-
- name: Dump job context
20-
env:
21-
JOB_CONTEXT: ${{ toJson(job) }}
22-
run: echo "$JOB_CONTEXT"
10+
- uses: actions/checkout@v4
11+
- name: Extract Netlify URL
12+
id: netlify_url
13+
run: |
14+
repo_name=$(echo ${{ github.repository }} | cut -d'/' -f2)
15+
echo "::set-output name=url::https://deploy-preview-${{ github.event.issue.number }}--${repo_name}.netlify.app"
16+
- name: Check PR author's privileges
17+
run: |
18+
response=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/${{ github.repository }}/collaborators/${{ github.event.pull_request.user.login }}/permission")
19+
permission=$(echo $response | jq -r '.permission')
20+
if [[ "$permission" != "admin" && "$permission" != "write" ]]; then
21+
echo "::error::The PR author does not have 'admin' or 'write' privileges."
22+
exit 1
23+
else
24+
echo "The PR author has 'admin' or 'write' privileges."
25+
fi
26+
- name: Trigger Browser Compatibility Tests
27+
uses: actions/github-script@v4
28+
with:
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
script: |
31+
github.repos.createDispatchEvent({
32+
owner: 'sendbird',
33+
repo: 'qe-browser-compatibility',
34+
event_type: 'bct-test-trigger',
35+
client_payload: {
36+
prNumber: ${{ github.event.issue.number }},
37+
repoName: '${{ github.repository }}',
38+
uikit_url: '${{ steps.netlify_url.outputs.url }}'
39+
}
40+
})

.github/workflows/pr-comment-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
pr-comment:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
# see list of commands: https://github.com/sendbird/release-automation-action#commands
1111
- uses: sendbird/release-automation-action@latest
1212
with:

.github/workflows/release-ticket-creation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout repository
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
1616

1717
- name: Verify branch name
1818
run: |

0 commit comments

Comments
 (0)