Skip to content

fix: awaits restoreOriginalUri Promise (#284) #50

fix: awaits restoreOriginalUri Promise (#284)

fix: awaits restoreOriginalUri Promise (#284) #50

name: Dispatch Downstream Update Samples Event
on:
push:
branches: [ master ]
release:
types: [ released ]
workflow_dispatch:
jobs:
dispatch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 14
- run: npm install semver [email protected]
- name: Dispatch event
uses: actions/github-script@v6
with:
github-token: ${{secrets.OKTA_433527}}
script: |
const semverMajor = require('semver/functions/major');
const execa = require('execa');
// get version from package.json
const pkgJsonVersion = require('./package.json').version;
// get latest version from registry
const { stdout: latestPublishedVersion } = await execa('npm', ['view', '@okta/okta-react', 'version']);
github.rest.repos.createDispatchEvent({
owner: context.repo.owner,
repo: 'samples-js-react',
event_type: 'update-samples',
client_payload: {
context,
// indicates if downstream repo should auto merge the generated samples
// merge when 1) in a "released" workflow or 2) non-breaking change
merge: context.workflow === 'released' || semverMajor(pkgJsonVersion) === semverMajor(latestPublishedVersion)
}
});