Skip to content

Commit

Permalink
Merge pull request #364 from HopkinsIDD/GH-363/documentation-pull-req…
Browse files Browse the repository at this point in the history
…uest-updates

Documentation GH Action And PR Template Updates
  • Loading branch information
TimothyWillard authored Nov 8, 2024
2 parents 7af554e + 7cfb92e commit b9cef88
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
### Describe your changes.

This pull request...


### Does this pull request make any user interface changes? If so please describe.

The user interface changes are...

Those are reflected in updates to the documentation in ...


### What does your pull request address? Tag relevant issues.

This pull request addresses GH-...


### Tag relevant team members.

@User...
31 changes: 19 additions & 12 deletions .github/workflows/create-docs-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@
# `documentation-gitbook` is behind Open A PR from `documentation-gitbook` into `main` Determine the directionality, if wrong dismiss and open a PR from `documentation-gitbook` into `main` Dismiss the PR from `main` into `documentation-gitbook`
# `documentation-gitbook` is ahead & behind Open 2 PRs Determine the directionality of the missing one and open that Nothing

name: create-docs-pr
name: Create GitBook Sync PRs

on:
workflow_dispatch:
schedule:
- cron: '1 10 * * 1-5'
pull_request:
types:
- closed
push:
branches:
- documentation-gitbook
paths:
- documentation/**

jobs:
create-pr:
create-prs:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || (github.event.pull_request.merged == true && (github.event.pull_request.base.ref == 'main' || github.event.pull_request.base.ref == 'documentation-gitbook'))
env:
DOCS_BRANCH: documentation-gitbook
PR_LABELS: 'documentation,high priority'
PR_ASSIGNEES: 'emprzy,jcblemai,pearsonca,saraloo,TimothyWillard'
PR_REVIEWERS: 'alsnhll,jcblemai,MacdonaldJoshuaCaleb,saraloo,shauntruelove,twallema'
PR_TITLE: 'Sync GitBook'
OWNER: 'HopkinsIDD'
REPO: 'flepiMoP'
Expand All @@ -42,17 +49,17 @@ jobs:
result-encoding: string
retries: 5
script: |
const { DOCS_AHEAD_MAIN, DOCS_BEHIND_MAIN, DOCS_BRANCH, PR_LABELS, PR_ASSIGNEES, PR_TITLE, OWNER, REPO } = process.env
const { DOCS_AHEAD_MAIN, DOCS_BEHIND_MAIN, DOCS_BRANCH, PR_LABELS, PR_REVIEWERS, PR_TITLE, OWNER, REPO } = process.env
const prLabels = PR_LABELS.split(",")
const prAssignees = PR_ASSIGNEES.split(",")
const cc = prAssignees.map(x => "@" + x).join(", ")
const prReviewers = PR_REVIEWERS.split(",")
const cc = prReviewers.map(x => "@" + x).join(", ")
const docsAheadMain = parseInt(DOCS_AHEAD_MAIN, 10)
const docsBehindMain = parseInt(DOCS_BEHIND_MAIN, 10)
if (isNaN(docsAheadMain) || isNaN(docsBehindMain)) {
throw new Error(`Cannot convert either "${DOCS_AHEAD_MAIN}" or "${DOCS_BEHIND_MAIN}" to integers.`)
}
const initialResults = await github.rest.search.issuesAndPullRequests({
q: `owner:${OWNER} repo:${REPO} is:open is:pr in:title '${PR_TITLE}'`
q: `repo:${OWNER}/${REPO} is:open is:pr in:title '${PR_TITLE}'`
})
const count = initialResults.data.total_count
if (count > 2) {
Expand Down Expand Up @@ -89,11 +96,11 @@ jobs:
issue_number: pr.data.number,
labels: prLabels
})
github.rest.issues.addAssignees({
github.rest.pulls.requestReviewers({
owner: OWNER,
repo: REPO,
issue_number: pr.data.number,
assignees: prAssignees
pull_number: pr.data.number,
reviewers: prReviewers
})
return pr.data.number
}
Expand Down

0 comments on commit b9cef88

Please sign in to comment.