Skip to content

Commit faab427

Browse files
authored
Add documentation and publish it to GitHub Pages. (#18)
* Initial commit to convert markdown to GitHub pages. * Make sure publish-pages action is reading our generated content. * Put the path arg on the right action. * only deploy on main * Hook in PR preview so we can see the pages before merge. * Fix "if" tests to get the right behavior. * Break doc publishing up so they trigger on the right things. * Add missing workflow * Update permissions so workflow can publish. * Should also need pull-request write so it can comment on the PR. * Checkpoint to see if this is working. * Add page artifact uploading. * Add initial set of rule documentation, mdformat everything and add a check to keep it formatted. * add index.md * Update docs.
1 parent 35b1cb2 commit faab427

File tree

9 files changed

+209
-83
lines changed

9 files changed

+209
-83
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Ensure that markdown files are properly formatted
2+
name: 'Check Markdown Format'
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- '**.md'
8+
9+
jobs:
10+
mdformat:
11+
name: 'mdformat'
12+
runs-on: 'ubuntu-latest'
13+
14+
steps:
15+
- name: 'Checkout Code'
16+
uses: 'actions/checkout@v4'
17+
18+
- name: 'Check Markdown Format'
19+
run: 'pipx run mdformat --check --wrap 100 .'

.github/workflows/publish_docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Publish Docs Site'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
pages: 'write'
11+
id-token: 'write'
12+
13+
jobs:
14+
build:
15+
name: "Build Docs"
16+
runs-on: 'ubuntu-latest'
17+
steps:
18+
- uses: 'actions/checkout@v4'
19+
- name: 'Generate HTML from Markdown'
20+
uses: 'ldeluigi/markdown-docs@latest'
21+
with:
22+
src: 'docs'
23+
dst: 'generated-pages'
24+
- name: 'Upload artifact'
25+
uses: 'actions/upload-pages-artifact@v3'
26+
with:
27+
path: 'generated-pages'
28+
deploy:
29+
name: "Deploy Docs"
30+
environment:
31+
name: 'github-pages'
32+
url: '${{ steps.deployment.outputs.page_url }}'
33+
runs-on: 'ubuntu-latest'
34+
needs: 'build'
35+
steps:
36+
- name: 'Deploy to GitHub Pages'
37+
id: 'deployment'
38+
uses: 'actions/deploy-pages@v4'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'Publish Preview of Docs Site'
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- closed
10+
11+
permissions:
12+
contents: 'write'
13+
pull-requests: 'write'
14+
15+
jobs:
16+
build:
17+
name: "Build PR Preview Docs"
18+
runs-on: 'ubuntu-latest'
19+
steps:
20+
- uses: 'actions/checkout@v4'
21+
- name: 'Generate HTML from Markdown'
22+
uses: 'ldeluigi/markdown-docs@latest'
23+
with:
24+
src: 'docs'
25+
dst: 'generated-pages'
26+
- name: 'Deploy GitHub Pages Preview'
27+
uses: rossjrw/pr-preview-action@v1
28+
with:
29+
source-dir: './generated-pages/'
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Publish Preview of Docs Site from branch'
2+
3+
# The publish_docs_preview.yml workflow takes a PR and publishes the results to it's own branch
4+
# so users can preview it. But that git branch then needs some way to publish, so this action does that.
5+
6+
on:
7+
push:
8+
branch:
9+
- gh-pages
10+
11+
permissions:
12+
pages: 'write'
13+
id-token: 'write'
14+
15+
16+
jobs:
17+
stage:
18+
name: "Stage PR preview from branch to pages"
19+
runs-on: 'ubuntu-latest'
20+
steps:
21+
- uses: 'actions/checkout@v4'
22+
with:
23+
ref: 'refs/heads/gh-pages'
24+
- name: 'Upload artifact'
25+
uses: 'actions/upload-pages-artifact@v3'
26+
with:
27+
path: '.'
28+
deploy:
29+
name: "Deploy PR Preview from branch to pages"
30+
needs: 'stage'
31+
environment:
32+
name: 'gh-pages-pr-preview'
33+
url: '${{ steps.deployment.outputs.page_url }}'
34+
runs-on: 'ubuntu-latest'
35+
steps:
36+
- name: 'Deploy to GitHub Pages'
37+
id: 'deployment'
38+
uses: 'actions/deploy-pages@v4'

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# The Home of GitHub Source Solutions
22

3-
This is where the team that manages GitHub for Google places things (like required workflows) to use across the enterprise.
3+
This is where the team that manages GitHub for Google places things (like required workflows) to use
4+
across the enterprise.
45

5-
We also own a number of other repositories. See them [here](https://github.com/topics/github-source-solutions)
6+
We also own a number of other repositories. See them
7+
[here](https://github.com/topics/github-source-solutions)

docs/code-of-conduct.md

Lines changed: 56 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,94 +2,82 @@
22

33
## Our Pledge
44

5-
In the interest of fostering an open and welcoming environment, we as
6-
contributors and maintainers pledge to making participation in our project and
7-
our community a harassment-free experience for everyone, regardless of age, body
8-
size, disability, ethnicity, gender identity and expression, level of
9-
experience, education, socio-economic status, nationality, personal appearance,
10-
race, religion, or sexual identity and orientation.
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers
6+
pledge to making participation in our project and our community a harassment-free experience for
7+
everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level
8+
of experience, education, socio-economic status, nationality, personal appearance, race, religion,
9+
or sexual identity and orientation.
1110

1211
## Our Standards
1312

14-
Examples of behavior that contributes to creating a positive environment
15-
include:
13+
Examples of behavior that contributes to creating a positive environment include:
1614

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
15+
- Using welcoming and inclusive language
16+
- Being respectful of differing viewpoints and experiences
17+
- Gracefully accepting constructive criticism
18+
- Focusing on what is best for the community
19+
- Showing empathy towards other community members
2220

2321
Examples of unacceptable behavior by participants include:
2422

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Disrespecting the community's time by sending spam or other unsolicited
32-
commercial messages
33-
* Other conduct which could reasonably be considered inappropriate in a
34-
professional setting
23+
- The use of sexualized language or imagery and unwelcome sexual attention or advances
24+
- Trolling, insulting/derogatory comments, and personal or political attacks
25+
- Public or private harassment
26+
- Publishing others' private information, such as a physical or electronic address, without explicit
27+
permission
28+
- Disrespecting the community's time by sending spam or other unsolicited commercial messages
29+
- Other conduct which could reasonably be considered inappropriate in a professional setting
3530

3631
## Our Responsibilities
3732

38-
Project maintainers are responsible for clarifying the standards of acceptable
39-
behavior and are expected to take appropriate and fair corrective action in
40-
response to any instances of unacceptable behavior.
33+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are
34+
expected to take appropriate and fair corrective action in response to any instances of unacceptable
35+
behavior.
4136

42-
Project maintainers have the right and responsibility to remove, edit, or reject
43-
comments, commits, code, wiki edits, issues, and other contributions that are
44-
not aligned to this Code of Conduct, or to ban temporarily or permanently any
45-
contributor for other behaviors that they deem inappropriate, threatening,
46-
offensive, or harmful.
37+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits,
38+
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or
39+
to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate,
40+
threatening, offensive, or harmful.
4741

4842
## Scope
4943

50-
This Code of Conduct applies both within project spaces and in public spaces
51-
when an individual is representing the project or its community. Examples of
52-
representing a project or community include using an official project e-mail
53-
address, posting via an official social media account, or acting as an appointed
54-
representative at an online or offline event. Representation of a project may be
44+
This Code of Conduct applies both within project spaces and in public spaces when an individual is
45+
representing the project or its community. Examples of representing a project or community include
46+
using an official project e-mail address, posting via an official social media account, or acting as
47+
an appointed representative at an online or offline event. Representation of a project may be
5548
further defined and clarified by project maintainers.
5649

57-
This Code of Conduct also applies outside the project spaces when the Project
58-
Steward has a reasonable belief that an individual's behavior may have a
59-
negative impact on the project or its community.
50+
This Code of Conduct also applies outside the project spaces when the Project Steward has a
51+
reasonable belief that an individual's behavior may have a negative impact on the project or its
52+
community.
6053

6154
## Conflict Resolution
6255

63-
We do not believe that all conflict is bad; healthy debate and disagreement
64-
often yield positive results. However, it is never okay to be disrespectful or
65-
to engage in behavior that violates the project’s code of conduct.
66-
67-
If you see someone violating the code of conduct, you are encouraged to address
68-
the behavior directly with those involved. Many issues can be resolved quickly
69-
and easily, and this gives people more control over the outcome of their
70-
dispute. If you are unable to resolve the matter for any reason, or if the
71-
behavior is threatening or harassing, report it. We are dedicated to providing
72-
an environment where participants feel welcome and safe.
73-
74-
Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the
75-
Project Steward(s) for *[PROJECT NAME]*. It is the Project Steward’s duty to
76-
receive and address reported violations of the code of conduct. They will then
77-
work with a committee consisting of representatives from the Open Source
78-
Programs Office and the Google Open Source Strategy team. If for any reason you
79-
are uncomfortable reaching out to the Project Steward, please email
80-
81-
82-
We will investigate every complaint, but you may not receive a direct response.
83-
We will use our discretion in determining when and how to follow up on reported
84-
incidents, which may range from not taking action to permanent expulsion from
85-
the project and project-sponsored spaces. We will notify the accused of the
86-
report and provide them an opportunity to discuss it before any action is taken.
87-
The identity of the reporter will be omitted from the details of the report
88-
supplied to the accused. In potentially harmful situations, such as ongoing
89-
harassment or threats to anyone's safety, we may take action without notice.
56+
We do not believe that all conflict is bad; healthy debate and disagreement often yield positive
57+
results. However, it is never okay to be disrespectful or to engage in behavior that violates the
58+
project’s code of conduct.
59+
60+
If you see someone violating the code of conduct, you are encouraged to address the behavior
61+
directly with those involved. Many issues can be resolved quickly and easily, and this gives people
62+
more control over the outcome of their dispute. If you are unable to resolve the matter for any
63+
reason, or if the behavior is threatening or harassing, report it. We are dedicated to providing an
64+
environment where participants feel welcome and safe.
65+
66+
Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the Project Steward(s) for
67+
*[PROJECT NAME]*. It is the Project Steward’s duty to receive and address reported violations of the
68+
code of conduct. They will then work with a committee consisting of representatives from the Open
69+
Source Programs Office and the Google Open Source Strategy team. If for any reason you are
70+
uncomfortable reaching out to the Project Steward, please email [email protected].
71+
72+
We will investigate every complaint, but you may not receive a direct response. We will use our
73+
discretion in determining when and how to follow up on reported incidents, which may range from not
74+
taking action to permanent expulsion from the project and project-sponsored spaces. We will notify
75+
the accused of the report and provide them an opportunity to discuss it before any action is taken.
76+
The identity of the reporter will be omitted from the details of the report supplied to the accused.
77+
In potentially harmful situations, such as ongoing harassment or threats to anyone's safety, we may
78+
take action without notice.
9079

9180
## Attribution
9281

93-
This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
94-
available at
82+
This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at
9583
https://www.contributor-covenant.org/version/1/4/code-of-conduct/

docs/contributing.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,23 @@ We would love to accept your patches and contributions to this project.
77
### Sign our Contributor License Agreement
88

99
Contributions to this project must be accompanied by a
10-
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
11-
You (or your employer) retain the copyright to your contribution; this simply
12-
gives us permission to use and redistribute your contributions as part of the
13-
project.
10+
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA). You (or your
11+
employer) retain the copyright to your contribution; this simply gives us permission to use and
12+
redistribute your contributions as part of the project.
1413

15-
If you or your current employer have already signed the Google CLA (even if it
16-
was for a different project), you probably don't need to do it again.
14+
If you or your current employer have already signed the Google CLA (even if it was for a different
15+
project), you probably don't need to do it again.
1716

18-
Visit <https://cla.developers.google.com/> to see your current agreements or to
19-
sign a new one.
17+
Visit <https://cla.developers.google.com/> to see your current agreements or to sign a new one.
2018

2119
### Review our Community Guidelines
2220

23-
This project follows [Google's Open Source Community
24-
Guidelines](https://opensource.google/conduct/).
21+
This project follows
22+
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
2523

2624
## Contribution process
2725

2826
### Code Reviews
2927

30-
All submissions, including submissions by project members, require review. We
31-
use [GitHub pull requests](https://docs.github.com/articles/about-pull-requests)
32-
for this purpose.
28+
All submissions, including submissions by project members, require review. We use
29+
[GitHub pull requests](https://docs.github.com/articles/about-pull-requests) for this purpose.

docs/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# GitHub Source Solutions
2+
3+
A collection of things we use to manage the Google Enterprise presence on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# pull-request-target-needs-exception
2+
3+
If you can, prefer using `pull_request` or other triggers instead of `pull_request_target`. The
4+
tl;dr here motivation is that workflows run from `pull_request_target` have (by default) read/write
5+
acesss to the repository and access to the secrets, even when run from a fork. If the workflow then
6+
checks out and runs the untrusted code from the PR, this is a problem.
7+
8+
GitHub has a really good writeup of the perils here:
9+
https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
10+
11+
For now, this rule is just a warning. It will eventually require an exception to use once we get
12+
that process working.

0 commit comments

Comments
 (0)