Skip to content

Create GitHub action #52

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 6 commits into from
Apr 12, 2023
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/* @browserstack/asi-devs
88 changes: 88 additions & 0 deletions .github/workflows/reviewing_changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# This job is to test different npm profiles in master branch against Pull Request raised
# This workflow targets wdio

name: NodeJS Test workflow on workflow_dispatch

on:
workflow_dispatch:
inputs:
pull_request_number:
description: 'The pull request number to build'
required: true

jobs:
comment-run:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 3
matrix:
node: ['14', '16', '18']
os: [ macos-latest, windows-latest, ubuntu-latest ]
name: WebDriverIO Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

steps:
- uses: actions/checkout@v3
with:
ref: refs/pull/${{ github.event.inputs.pull_request_number }}/head
- name: Fetch Commit SHA
run: |
git log -1 --format='%H'
echo "commit_sha=$(git log -1 --format='%H')" >> $GITHUB_ENV
echo "commit_sha=$(git log -1 --format='%H')" >> $env:GITHUB_ENV
- uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
id: status-check-in-progress
env:
job_name: WebDriverIO Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
with:
github-token: ${{ github.token }}
script: |
const result = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: process.env.job_name,
head_sha: process.env.commit_sha,
status: 'in_progress'
}).catch((err) => ({status: err.status, response: err.response}));
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
if (result.status !== 201) {
console.log('Failed to create check run')
}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: npm install

- name: Run sample tests
run: npm run test

- name: Run local tests
run: npm run local

- if: always()
uses: actions/github-script@98814c53be79b1d30f795b907e553d8679345975
id: status-check-completed
env:
conclusion: ${{ job.status }}
job_name: WebDriverIO Repo ${{ matrix.node }} - ${{ matrix.os }} Sample
with:
github-token: ${{ github.token }}
script: |
const result = await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: process.env.job_name,
head_sha: process.env.commit_sha,
status: 'completed',
conclusion: process.env.conclusion
}).catch((err) => ({status: err.status, response: err.response}));
console.log(`The status-check response : ${result.status} Response : ${JSON.stringify(result.response)}`)
if (result.status !== 201) {
console.log('Failed to create check run')
}