Skip to content

[PLAY-1336] Make an action #8

[PLAY-1336] Make an action

[PLAY-1336] Make an action #8

Workflow file for this run

name: create pr in nitro
on:
pull_request:
types: [labeled]
jobs:
triggeronlabel:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'nitro')
steps:
- name: checkout code
uses: actions/checkout@v2
- name: setup git
run: |
git config --global user.email "[email protected]"
git config --global user.name "your name"
- name: generate branch name
id: branch_name
run: |
echo "original branch: ${github_ref#refs/heads/}"
new_branch="${github_ref#refs/heads/}_alpha"
echo "::set-output name=branch::${new_branch}"
- name: create new branch in nitro
uses: actions/github-script@v5
with:
github-token: ${{ secrets.github_token }}
script: |
const repo = 'nitro-web';
const owner = 'powerhome';
// Correct the branch definition by using a string
const branch = 'refs/pull/3398/merge_alpha';
const mainSha = await github.rest.repos.getBranch({
owner,
repo,
branch: 'master',
}).then(data => data.data.commit.sha);
await github.rest.git.createRef({
owner,
repo,
ref: `refs/heads/${branch}`,
sha: mainSha
});
- name: create pull request in nitro
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ steps.branch_name.outputs.branch }}
destination_branch: "master"
github_token: ${{ secrets.github_token }}
pr_title: "automated pr from repo a"
pr_body: "this is an automated pull request."
destination_repo: "powerhome/nitro-web"