Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use Github Script action to sync carbon-platform. branch #3385

Merged
merged 2 commits into from
Feb 13, 2023
Merged
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
50 changes: 35 additions & 15 deletions .github/workflows/sync-platform-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,45 @@ on:

# Enable running this workflow manually from the Actions tab
workflow_dispatch: # Allow for running this manually.

jobs:
sync-branches:
runs-on: ubuntu-latest
name: Syncing branches
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3

- name: Create PR branch 🤖
run: |
git branch carbon-platform-sync
git push origin carbon-platform-sync

- name: Create Pull Request
uses: actions/github-script@v6
with:
node-version: 16
- name: Opening pull request
id: pull
uses: tretuna/sync-branches@1.4.0
with:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
FROM_BRANCH: "main"
TO_BRANCH: "carbon-platform"
PULL_REQUEST_BODY: "Platform Sync, pulling in new content from main into carbon-platform branch"
CONTENT_COMPARISON: true
REVIEWERS: '["francinelucca","andreancardona","alisonjoseph"]'
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'Sync carbon-platform branch',
owner,
repo,
head: 'carbon-platform-sync',
base: 'carbon-platform',
body: [
'Platform Sync, pulling in new content from main into carbon-platform branch',
'This PR is auto-generated by [actions/github-script](https://github.com/actions/github-script).',
"**Note**: It’s ok for the CI cheks to fail on this PR, this code is not runnable due to the platform changes"
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['status: enable automerge 🟠', 'status: ready for review 👀']
});
github.rest.pulls.requestReviewers({
owner,
repo,
pull_number: result.data.number,
reviewers: ['francinelucca', 'andreancardona', 'alisonjoseph']
});