Unverified Commit 53a92f87 authored by Maia Teegarden's avatar Maia Teegarden Committed by GitHub

Add trigger for v0 sync workflow (#81645)

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
parent a87a0721
...@@ -89,10 +89,20 @@ jobs: ...@@ -89,10 +89,20 @@ jobs:
DD_ENV=ci npx @datadog/datadog-ci@2.23.1 junit upload --tags test.type:deploy --service nextjs ./test/test-junit-report DD_ENV=ci npx @datadog/datadog-ci@2.23.1 junit upload --tags test.type:deploy --service nextjs ./test/test-junit-report
fi fi
front-sync: sync-repositories:
needs: test-deploy needs: test-deploy
if: ${{ always() && github.repository_owner == 'vercel' && github.event_name == 'release' }} if: ${{ always() && github.repository_owner == 'vercel' && github.event_name == 'release' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- repo: front
workflow_id: cron-update-next.yml
workflow_url: https://github.com/vercel/front/actions/workflows/cron-update-next.yml?query=event%3Aworkflow_dispatch
- repo: v0
workflow_id: update-next.yml
workflow_url: https://github.com/vercel/v0/actions/workflows/update-next.yml?query=event%3Aworkflow_dispatch
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- id: nextPackageInfo - id: nextPackageInfo
...@@ -128,8 +138,8 @@ jobs: ...@@ -128,8 +138,8 @@ jobs:
"GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}", "GET /repos/{owner}/{repo}/actions/workflows/{workflow_id}",
{ {
owner: "vercel", owner: "vercel",
repo: "front", repo: "${{ matrix.repo }}",
workflow_id: "cron-update-next.yml", workflow_id: "${{ matrix.workflow_id }}",
} }
); );
...@@ -143,8 +153,8 @@ jobs: ...@@ -143,8 +153,8 @@ jobs:
return 'false'; return 'false';
} }
- uses: actions/github-script@v7 - uses: actions/github-script@v7
name: Trigger vercel/front sync name: Trigger vercel/${{ matrix.repo }} sync
id: trigger-front-sync id: trigger-sync
if: steps.check-workflow-enabled.outputs.result == 'true' if: steps.check-workflow-enabled.outputs.result == 'true'
with: with:
retries: 3 retries: 3
...@@ -152,7 +162,7 @@ jobs: ...@@ -152,7 +162,7 @@ jobs:
# Default github token cannot dispatch events to the remote repo, it should be # Default github token cannot dispatch events to the remote repo, it should be
# a PAT with Actions write access (https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event) # a PAT with Actions write access (https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#create-a-workflow-dispatch-event)
github-token: ${{ secrets.GH_UPDATE_NEXT_WORKFLOW_TRIGGER }} github-token: ${{ secrets.GH_UPDATE_NEXT_WORKFLOW_TRIGGER }}
# Note `workflow_id` and `inputs` are contract between vercel/front, # Note `workflow_id` and `inputs` are contract between vercel/${{ matrix.repo }},
# if these need to be changed both side should be updated accordingly. # if these need to be changed both side should be updated accordingly.
script: | script: |
const immediatelyClose = '${{ steps.test-result.outputs.immediately-close }}'; const immediatelyClose = '${{ steps.test-result.outputs.immediately-close }}';
...@@ -168,8 +178,8 @@ jobs: ...@@ -168,8 +178,8 @@ jobs:
"POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches", "POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches",
{ {
owner: "vercel", owner: "vercel",
repo: "front", repo: "${{ matrix.repo }}",
workflow_id: "cron-update-next.yml", workflow_id: "${{ matrix.workflow_id }}",
ref: "main", ref: "main",
inputs: inputs, inputs: inputs,
} }
...@@ -177,10 +187,10 @@ jobs: ...@@ -177,10 +187,10 @@ jobs:
// Ideally we'd include a URL to this specific sync. // Ideally we'd include a URL to this specific sync.
// However, creating a workflow_dispatch event does not produce an ID: https://github.com/orgs/community/discussions/9752 // However, creating a workflow_dispatch event does not produce an ID: https://github.com/orgs/community/discussions/9752
console.info( console.info(
"Sync started in https://github.com/vercel/front/actions/workflows/cron-update-next.yml?query=event%3Aworkflow_dispatch" "Sync started in ${{ matrix.workflow_url }}"
); );
console.info( console.info(
"This may not start a new sync if one is already in progress. Check the logs of the cron-update-next Workflow run." "This may not start a new sync if one is already in progress. Check the logs of the workflow run."
); );
if (immediatelyClose === 'true') { if (immediatelyClose === 'true') {
console.info( console.info(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment