Skip to content

Commit 16eae7e

Browse files
author
Martin Lopes
authored
Merge branch 'main' into al-cheb/windows-default-shell
2 parents 5df8a06 + db9246d commit 16eae7e

85 files changed

Lines changed: 1217 additions & 863 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/allowed-actions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = [
2525
'pascalgn/automerge-action@c9bd182',
2626
'peter-evans/create-issue-from-file@a04ce672e3acedb1f8e416b46716ddfd09905326',
2727
'peter-evans/create-or-update-comment@5221bf4aa615e5c6e95bb142f9673a9c791be2cd',
28-
'peter-evans/create-pull-request@938e6aea6f8dbdaced2064e948cb806c77fe87b8',
28+
'peter-evans/create-pull-request@8c603dbb04b917a9fc2dd991dc54fef54b640b43',
2929
'rachmari/actions-add-new-issue-to-column@1a459ef92308ba7c9c9dc2fcdd72f232495574a9',
3030
'rachmari/labeler@832d42ec5523f3c6d46e8168de71cd54363e3e2e',
3131
'repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88',

.github/workflows/remove-unused-assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Remove script results file
3434
run: rm -rf ./results.md
3535
- name: Create pull request
36-
uses: peter-evans/create-pull-request@938e6aea6f8dbdaced2064e948cb806c77fe87b8
36+
uses: peter-evans/create-pull-request@8c603dbb04b917a9fc2dd991dc54fef54b640b43
3737
with:
3838
# need to use a token with repo and workflow scopes for this step
3939
token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}

.github/workflows/repo-sync-stalls.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
const timeDelta = Date.now() - Date.parse(pr.created_at);
4141
const minutesOpen = timeDelta / 1000 / 60;
4242
43-
if (minutesOpen > 30) {
43+
if (minutesOpen > 180) {
4444
core.setFailed('Repo sync appears to be stalled')
4545
}
4646
})

.github/workflows/repo-sync.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
github_token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
4545

4646
- name: Create pull request
47+
id: create-pull
4748
uses: repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d
4849
env:
4950
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
@@ -70,6 +71,35 @@ jobs:
7071
github-token: ${{ secrets.GITHUB_TOKEN }}
7172
number: ${{ steps.find-pull-request.outputs.number }}
7273

74+
# There are cases where the branch becomes out-of-date in between the time this workflow began and when the pull request is created/updated
75+
- name: Update branch
76+
if: ${{ steps.find-pull-request.outputs.number }}
77+
uses: actions/github-script@626af12fe9a53dc2972b48385e7fe7dec79145c9
78+
with:
79+
github-token: ${{ secrets.GITHUB_TOKEN }}
80+
script: |
81+
const mainHeadSha = await github.git.getRef({
82+
...context.repo,
83+
ref: 'heads/main'
84+
})
85+
console.log(`heads/main sha: ${mainHeadSha.data.object.sha}`)
86+
87+
const pull = await github.pulls.get({
88+
...context.repo,
89+
pull_number: parseInt(${{ steps.find-pull-request.outputs.number }})
90+
})
91+
console.log(`Pull request base sha: ${pull.data.base.sha}`)
92+
93+
if (mainHeadSha.data.object.sha !== pull.data.base.sha || pull.data.mergeable_state === 'behind') {
94+
const updateBranch = await github.pulls.updateBranch({
95+
...context.repo,
96+
pull_number: parseInt(${{ steps.find-pull-request.outputs.number }})
97+
})
98+
console.log(updateBranch.data.message)
99+
} else {
100+
console.log(`Branch is already up-to-date`)
101+
}
102+
73103
- name: Send Slack notification if workflow fails
74104
uses: someimportantcompany/github-actions-slack-message@0b470c14b39da4260ed9e3f9a4f1298a74ccdefd
75105
if: failure()

.github/workflows/update-graphql-files.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ env:
1010

1111
on:
1212
workflow_dispatch:
13-
#schedule:
14-
#- cron: '20 16 * * *' # run every day at 16:20 UTC / 8:20 PST
13+
schedule:
14+
- cron: '20 16 * * *' # run every day at 16:20 UTC / 8:20 PST
1515

1616
jobs:
1717
update_graphql_files:
@@ -37,15 +37,15 @@ jobs:
3737
- name: Run updater scripts
3838
env:
3939
# need to use a token from a user with access to github/github for this step
40-
GITHUB_TOKEN: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
40+
GITHUB_TOKEN: ${{ secrets.RACHMARI_REPO_WORKFLOW }}
4141
run: |
4242
script/graphql/update-files.js
4343
- name: Create pull request
4444
id: create-pull-request
45-
uses: peter-evans/create-pull-request@938e6aea6f8dbdaced2064e948cb806c77fe87b8
45+
uses: peter-evans/create-pull-request@8c603dbb04b917a9fc2dd991dc54fef54b640b43
4646
with:
4747
# need to use a token with repo and workflow scopes for this step
48-
token: ${{ secrets.OCTOMERGER_PAT_WITH_REPO_AND_WORKFLOW_SCOPE }}
48+
token: ${{ secrets.GITHUB_TOKEN }}
4949
commit-message: 'Action ran graphql script"update-files"'
5050
title: GraphQL schema update
5151
body:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ We (usually the docs team, but sometimes GitHub product managers, engineers, or
152152
You should always review your own PR first.
153153

154154
For content changes, make sure that you:
155-
- [ ] Confirm that the changes address every part of the content strategy plan from your issue (if there are differences, explain them).
155+
- [ ] Confirm that the changes address every part of the content design plan from your issue (if there are differences, explain them).
156156
- [ ] Review the content for technical accuracy.
157157
- [ ] Review the entire pull request using the [localization checklist](contributing/localization-checklist.md).
158158
- [ ] Copy-edit the changes for grammar, spelling, and adherence to the style guide.

Gemfile.lock

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ GEM
1010

1111
PLATFORMS
1212
ruby
13+
x86_64-linux
1314

1415
DEPENDENCIES
1516
graphql (= 1.10.6)
1617
graphql-schema_comparator (~> 1.0.0)
1718

1819
BUNDLED WITH
19-
2.1.4
20+
2.2.1

app.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
"env": {
44
"NODE_ENV": "production",
55
"NPM_CONFIG_PRODUCTION": "true",
6-
"ENABLED_LANGUAGES": "en, de"
6+
"ENABLED_LANGUAGES": "en"
77
},
88
"buildpacks": [
9-
{ "url": "https://github.com/DataDog/heroku-buildpack-datadog.git#1.21" },
109
{ "url": "heroku/nodejs" }
1110
],
1211
"formation": {

content/actions/guides/building-and-testing-nodejs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ steps:
195195

196196
To authenticate to your private registry, you'll need to store your npm authentication token as a secret. For example, create a repository secret called `NPM_TOKEN`. For more information, see "[Creating and using encrypted secrets](/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)."
197197

198-
In the example below, the secret `NPM_TOKEN` stores the npm authentication token. The `setup-node` action configures the *.npmrc* file to read the npm authentication token from the `NODE_AUTH_TOKEN` environment variable. When using the `setup-node` action to create an *.npmrc* file, you must set the `NPM_AUTH_TOKEN` environment variable with the secret that contains your npm authentication token.
198+
In the example below, the secret `NPM_TOKEN` stores the npm authentication token. The `setup-node` action configures the *.npmrc* file to read the npm authentication token from the `NODE_AUTH_TOKEN` environment variable. When using the `setup-node` action to create an *.npmrc* file, you must set the `NODE_AUTH_TOKEN` environment variable with the secret that contains your npm authentication token.
199199

200200
Before installing dependencies, use the `setup-node` action to create the *.npmrc* file. The action has two input parameters. The `node-version` parameter sets the Node.js version, and the `registry-url` parameter sets the default registry. If your package registry uses scopes, you must use the `scope` parameter. For more information, see [`npm-scope`](https://docs.npmjs.com/misc/scope).
201201

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
---
2+
title: Deploying to Amazon Elastic Container Service
3+
intro: You can deploy to Amazon Elastic Container Service (ECS) as part of your continuous deployment (CD) workflows.
4+
product: '{% data reusables.gated-features.actions %}'
5+
versions:
6+
free-pro-team: '*'
7+
enterprise-server: '>=2.22'
8+
---
9+
10+
{% data reusables.actions.enterprise-beta %}
11+
{% data reusables.actions.enterprise-github-hosted-runners %}
12+
13+
### Introduction
14+
15+
This guide explains how to use {% data variables.product.prodname_actions %} to build a containerized application, push it to [Amazon Elastic Container Registry (ECR)](https://aws.amazon.com/ecr/), and deploy it to [Amazon Elastic Container Service (ECS)](https://aws.amazon.com/ecs/).
16+
17+
On every new release in your {% data variables.product.company_short %} repository, the {% data variables.product.prodname_actions %} workflow builds and pushes a new container image to Amazon ECR, and then deploys a new task definition to Amazon ECS.
18+
19+
### Prerequisites
20+
21+
Before creating your {% data variables.product.prodname_actions %} workflow, you will first need to complete the following setup steps for Amazon ECR and ECS:
22+
23+
1. Create an Amazon ECR repository to store your images.
24+
25+
For example, using [the AWS CLI](https://aws.amazon.com/cli/):
26+
27+
{% raw %}```bash{:copy}
28+
aws ecr create-repository \
29+
--repository-name MY_ECR_REPOSITORY \
30+
--region MY_AWS_REGION
31+
```{% endraw %}
32+
33+
Ensure that you use the same Amazon ECR repository name (represented here by `MY_ECR_REPOSITORY`) for the `ECR_REPOSITORY` variable in the workflow below.
34+
35+
Ensure that you use the same AWS region value for the `AWS_REGION` (represented here by `MY_AWS_REGION`) variable in the workflow below.
36+
37+
2. Create an Amazon ECS task definition, cluster, and service.
38+
39+
For details, follow the [Getting started wizard on the Amazon ECS console](https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun), or the [Getting started guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/getting-started-fargate.html) in the Amazon ECS documentation.
40+
41+
Ensure that you note the names you set for the Amazon ECS service and cluster, and use them for the `ECS_SERVICE` and `ECS_CLUSTER` variables in the workflow below.
42+
43+
3. Store your Amazon ECS task definition as a JSON file in your {% data variables.product.company_short %} repository.
44+
45+
The format of the file should be the same as the output generated by:
46+
47+
{% raw %}```bash{:copy}
48+
aws ecs register-task-definition --generate-cli-skeleton
49+
```{% endraw %}
50+
51+
Ensure that you set the `ECS_TASK_DEFINITION` variable in the workflow below as the path to the JSON file.
52+
53+
Ensure that you set the `CONTAINER_NAME` variable in the workflow below as the container name in the `containerDefinitions` section of the task definition.
54+
55+
4. Create {% data variables.product.prodname_actions %} secrets named `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` to store the values for your Amazon IAM access key.
56+
57+
For more information on creating secrets for {% data variables.product.prodname_actions %}, see "[Encrypted secrets](/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository)."
58+
59+
See the documentation for each action used below for the recommended IAM policies for the IAM user, and methods for handling the access key credentials.
60+
61+
### Creating the workflow
62+
63+
Once you've completed the prerequisites, you can proceed with creating the workflow.
64+
65+
The following example workflow demonstrates how to build a container image and push it to Amazon ECR. It then updates the task definition with the new image ID, and deploys the task definition to Amazon ECS.
66+
67+
Ensure that you provide your own values for all the variables in the `env` key of the workflow.
68+
69+
{% raw %}
70+
```yaml{:copy}
71+
name: Deploy to Amazon ECS
72+
73+
on:
74+
release:
75+
types: [ created ]
76+
77+
env:
78+
AWS_REGION: MY_AWS_REGION # set this to your preferred AWS region, e.g. us-west-1
79+
ECR_REPOSITORY: MY_ECR_REPOSITORY # set this to your Amazon ECR repository name
80+
ECS_SERVICE: MY_ECS_SERVICE # set this to your Amazon ECS service name
81+
ECS_CLUSTER: MY_ECS_CLUSTER # set this to your Amazon ECS cluster name
82+
ECS_TASK_DEFINITION: MY_ECS_TASK_DEFINITION # set this to the path to your Amazon ECS task definition
83+
# file, e.g. .aws/task-definition.json
84+
CONTAINER_NAME: MY_CONTAINER_NAME # set this to the name of the container in the
85+
# containerDefinitions section of your task definition
86+
87+
defaults:
88+
run:
89+
shell: bash
90+
91+
jobs:
92+
deploy:
93+
name: Deploy
94+
runs-on: ubuntu-latest
95+
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@v2
99+
100+
- name: Configure AWS credentials
101+
uses: aws-actions/configure-aws-credentials@v1
102+
with:
103+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
104+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
105+
aws-region: $AWS_REGION
106+
107+
- name: Login to Amazon ECR
108+
id: login-ecr
109+
uses: aws-actions/amazon-ecr-login@v1
110+
111+
- name: Build, tag, and push image to Amazon ECR
112+
id: build-image
113+
env:
114+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
115+
IMAGE_TAG: ${{ github.sha }}
116+
run: |
117+
# Build a docker container and
118+
# push it to ECR so that it can
119+
# be deployed to ECS.
120+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
121+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
122+
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV
123+
124+
- name: Fill in the new image ID in the Amazon ECS task definition
125+
id: task-def
126+
uses: aws-actions/amazon-ecs-render-task-definition@v1
127+
with:
128+
task-definition: $ECS_TASK_DEFINITION
129+
container-name: $CONTAINER_NAME
130+
image: ${{ steps.build-image.outputs.image }}
131+
132+
- name: Deploy Amazon ECS task definition
133+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
134+
with:
135+
task-definition: ${{ steps.task-def.outputs.task-definition }}
136+
service: $ECS_SERVICE
137+
cluster: $ECS_CLUSTER
138+
wait-for-service-stability: true
139+
```
140+
{% endraw %}
141+
142+
### Additional resources
143+
144+
For more information on the services used in these examples, see the following documentation:
145+
146+
* "[Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)" in the Amazon AWS documentation.
147+
* Official AWS "[Configure AWS Credentials](https://github.com/aws-actions/configure-aws-credentials)" action.
148+
* Official AWS [Amazon ECR "Login"](https://github.com/aws-actions/amazon-ecr-login) action.
149+
* Official AWS [Amazon ECS "Render Task Definition"](https://github.com/aws-actions/amazon-ecs-render-task-definition) action.
150+
* Official AWS [Amazon ECS "Deploy Task Definition"](https://github.com/aws-actions/amazon-ecs-deploy-task-definition) action.

0 commit comments

Comments
 (0)