Skip to content

trigger-nightly

trigger-nightly #182

# workflow to push an empty commit and trigger pkg.pr.new on @vitejs/plugin-rsc PR
# https://github.com/vitejs/vite-plugin-react/pull/524
# cf. React nightly workflow
# https://github.com/facebook/react/blob/5d87cd224452c68d09bef99656b6261e9772a210/.github/workflows/runtime_prereleases_nightly.yml#L12
name: trigger-nightly
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
trigger-nightly:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v4
with:
repository: hi-ogawa/vite-plugin-react
ref: chore-rsc-nightly
token: ${{ secrets.REACT_NIGHTLY_TRIGGER_TOKEN }}
fetch-depth: 0
- name: git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote add upstream https://github.com/vitejs/vite-plugin-react.git
git fetch upstream main
git merge upstream/main
NIGHTLY_VERSION=$(npm view react dist-tags.canary --json | jq -r 'split("-") | .[-2:] | join("-")')
git commit --allow-empty -m "chore: nightly ${NIGHTLY_VERSION}"
git push
- name: Create issue on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `Nightly trigger workflow failed - ${context.runId}`,
body: `
**Nightly PR:** https://github.com/vitejs/vite-plugin-react/pull/524
**Failed Run:** ${context.payload.repository.html_url}/actions/runs/${context.runId}
`
})