Skip to content

Commit

Permalink
Merge pull request #120 from scalar-labs/add-auto-pr-workflows
Browse files Browse the repository at this point in the history
Add workflows to automatically create PRs for includes from private docs repository
  • Loading branch information
josh-wong authored Jan 9, 2024
2 parents 97fb4c6 + 578fc9f commit 554b303
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/auto-create-pr-common-includes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow auto-creates PRs for common includes that come from the centralized private docs repository where we update our docs.
name: ✨ Auto-create pull request - Common includes

on:
push:
branches:
- sync-common-includes

jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Create pull request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'AUTO: Docs repo sync - Common includes',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: [
'This is an automated pull request (PR) to sync changes to common includes in the centralized private docs repo to this public docs site repo.',
'',
'Before merging this PR, confirm the following:',
'',
'- [ ] I have confirmed that this PR can be merged without waiting (if necessary).',
' - An example of when a PR must wait to be merged is when the docs are part of a pending release of a new product version.'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['documentation', 'triage']
});
39 changes: 39 additions & 0 deletions .github/workflows/auto-create-pr-helm-charts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow auto-creates PRs for Helm Charts docs that come from the centralized private docs repository where we update our docs.
name: ✨ Auto-create pull request - Helm Charts docs

on:
push:
branches:
- helm-charts/**

jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Create pull request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'AUTO: Docs repo sync - Helm Charts',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: [
'This is an automated pull request (PR) to sync changes to Helm Charts docs in the centralized private docs repo to this public docs site repo.',
'',
'Before merging this PR, confirm the following:',
'',
'- [ ] I have updated the side navigation to include new docs or remove deleted docs (if necessary).',
'- [ ] I have confirmed that this PR can be merged without waiting (if necessary).',
' - An example of when a PR must wait to be merged is when the docs are part of a pending release of a new product version.'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['documentation', 'helm-charts', 'triage']
});
39 changes: 39 additions & 0 deletions .github/workflows/auto-create-pr-scalar-kubernetes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow auto-creates PRs for Scalar Kubernetes docs that come from the centralized private docs repository where we update our docs.
name: ✨ Auto-create pull request - Scalar Kubernetes docs

on:
push:
branches:
- scalar-kubernetes/**

jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Create pull request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'AUTO: Docs repo sync - Scalar Kubernetes',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: [
'This is an automated pull request (PR) to sync changes to Scalar Kubernetes docs in the centralized private docs repo to this public docs site repo.',
'',
'Before merging this PR, confirm the following:',
'',
'- [ ] I have updated the side navigation to include new docs or remove deleted docs (if necessary).',
'- [ ] I have confirmed that this PR can be merged without waiting (if necessary).',
' - An example of when a PR must wait to be merged is when the docs are part of a pending release of a new product version.'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['documentation', 'scalar-kubernetes', 'triage']
});
38 changes: 38 additions & 0 deletions .github/workflows/auto-create-pr-scalardb-includes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow auto-creates PRs for ScalarDB includes that come from the centralized private docs repository where we update our docs.
name: ✨ Auto-create pull request - ScalarDB includes

on:
push:
branches:
- sync-scalardb-includes

jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Create pull request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'AUTO: Docs repo sync - ScalarDB includes',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: [
'This is an automated pull request (PR) to sync changes to ScalarDB includes in the centralized private docs repo to this public docs site repo.',
'',
'Before merging this PR, confirm the following:',
'',
'- [ ] I have confirmed that this PR can be merged without waiting (if necessary).',
' - An example of when a PR must wait to be merged is when the docs are part of a pending release of a new product version.'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['documentation', 'scalardb', 'triage']
});
39 changes: 39 additions & 0 deletions .github/workflows/auto-create-pr-scalardb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow auto-creates PRs for ScalarDB docs that come from the centralized private docs repository where we update our docs.
name: ✨ Auto-create pull request - ScalarDB docs

on:
push:
branches:
- scalardb/**

jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Create pull request
uses: actions/github-script@v7
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: 'AUTO: Docs repo sync - ScalarDB',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'main',
body: [
'This is an automated pull request (PR) to sync changes to ScalarDB docs in the centralized private docs repo to this public docs site repo.',
'',
'Before merging this PR, confirm the following:',
'',
'- [ ] I have updated the side navigation to include new docs or remove deleted docs (if necessary).',
'- [ ] I have confirmed that this PR can be merged without waiting (if necessary).',
' - An example of when a PR must wait to be merged is when the docs are part of a pending release of a new product version.'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['documentation', 'scalardb', 'triage']
});

0 comments on commit 554b303

Please sign in to comment.