Skip to content

Commit e5cd667

Browse files
authored
fix: add required permissions and credentials setup guide (#21)
* fix: add format script and check/fix json and md files as well * fix: prettierify files * add permissions section to readme
1 parent 3fd9b9c commit e5cd667

File tree

4 files changed

+60
-12
lines changed

4 files changed

+60
-12
lines changed

CODE_OF_CONDUCT.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
## Code of Conduct
2+
23
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
34
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
45
[email protected] with any additional questions or comments.

CONTRIBUTING.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,23 @@ documentation, we greatly value feedback and contributions from our community.
66
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary
77
information to effectively respond to your bug report or contribution.
88

9-
109
## Reporting Bugs/Feature Requests
1110

1211
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
1312

1413
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already
1514
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
1615

17-
* A reproducible test case or series of steps
18-
* The version of our code being used
19-
* Any modifications you've made relevant to the bug
20-
* Anything unusual about your environment or deployment
21-
16+
- A reproducible test case or series of steps
17+
- The version of our code being used
18+
- Any modifications you've made relevant to the bug
19+
- Anything unusual about your environment or deployment
2220

2321
## Contributing via Pull Requests
22+
2423
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
2524

26-
1. You are working against the latest source on the *master* branch.
25+
1. You are working against the latest source on the _master_ branch.
2726
2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
2827
3. You open an issue to discuss any significant work - we would hate for your time to be wasted.
2928

@@ -39,20 +38,19 @@ To send us a pull request, please:
3938
GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and
4039
[creating a pull request](https://help.github.com/articles/creating-a-pull-request/).
4140

42-
4341
## Finding contributions to work on
44-
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
4542

43+
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
4644

4745
## Code of Conduct
46+
4847
This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
4948
For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
5049
[email protected] with any additional questions or comments.
5150

52-
5351
## Security issue notifications
54-
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
5552

53+
If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue.
5654

5755
## Licensing
5856

README.md

+48
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,41 @@ that are impossible, difficult, or simply expensive
7676
to access from GitHub's hosted job runners
7777
but are easy or cheap to access from CodeBuild.
7878

79+
## Credentials and Permissions
80+
81+
In order for the action to run your CodeBuild project,
82+
you need to provide AWS credentials.
83+
We recommend using [aws-actions/configure-aws-credentials]
84+
to configure your credentials for a job.
85+
86+
The credentials that you provide need to have the following permissions:
87+
88+
- `codebuild:StartBuild`
89+
- `codebuild:BatchGetBuilds`
90+
- `logs:GetLogEvents`
91+
92+
For example:
93+
94+
```json
95+
{
96+
"Version": "2012-10-17",
97+
"Statement": [
98+
{
99+
"Effect": "Allow",
100+
"Action": ["codebuild:StartBuild", "codebuild:BatchGetBuilds"],
101+
"Resource": ["arn:aws:codebuild:REGION:ACCOUNT_ID:project/PROJECT_NAME"]
102+
},
103+
{
104+
"Effect": "Allow",
105+
"Action": ["logs:GetLogEvents"],
106+
"Resource": [
107+
"arn:aws:logs:REGION:ACCOUNT_ID:log-group:/aws/codebuild/PROJECT_NAME:*"
108+
]
109+
}
110+
]
111+
}
112+
```
113+
79114
## Examples
80115

81116
These examples show how you can define a step in a workflow job.
@@ -86,6 +121,12 @@ If your CodeBuild project is already configured the way you want it,
86121
the only CodeBuild Run input you need to provide is the project name.
87122

88123
```yaml
124+
- name: Configure AWS Credentials
125+
uses: aws-actions/configure-aws-credentials@v1
126+
with:
127+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
128+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
129+
aws-region: us-east-2
89130
- name: Run CodeBuild
90131
uses: aws-actions/aws-codebuild-run-project@v1
91132
with:
@@ -102,6 +143,12 @@ If any of these environment variables are defined in the CodeBuild project,
102143
this will overwrite them.
103144

104145
```yaml
146+
- name: Configure AWS Credentials
147+
uses: aws-actions/configure-aws-credentials@v1
148+
with:
149+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
150+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
151+
aws-region: us-east-2
105152
- name: Run CodeBuild
106153
uses: aws-actions/aws-codebuild-run-project@v1
107154
with:
@@ -177,3 +224,4 @@ see LICENSE and NOTICE for more information.
177224
[github environment variables]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables
178225
[github actions job runners]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/virtual-environments-for-github-hosted-runners#supported-runners-and-hardware-resources
179226
[github workflow syntax]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
227+
[aws-actions/configure-aws-credentials]: https://github.com/aws-actions/configure-aws-credentials

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Execute CodeBuild::startBuild for the current repo.",
55
"main": "index.js",
66
"scripts": {
7-
"lint": "prettier -c *.js test/*.js; eslint **.js test/**.js",
7+
"lint": "prettier -c *.js *.json *.md test/*.js; eslint **.js test/**.js",
8+
"format": "prettier --write -c *.js *.json *.md test/*.js; eslint --fix **.js test/**.js",
89
"package": "ncc build index.js -o dist",
910
"test": "mocha"
1011
},

0 commit comments

Comments
 (0)