Skip to content

Commit a1ae61c

Browse files
committed
Add linters
1 parent e118195 commit a1ae61c

File tree

7 files changed

+38
-21
lines changed

7 files changed

+38
-21
lines changed

.github/workflows/integration.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ env:
2424

2525
jobs:
2626
test:
27-
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
27+
if: |-
28+
${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
2829
runs-on: 'ubuntu-latest'
2930

3031
steps:
@@ -35,13 +36,13 @@ jobs:
3536
- id: 'compute-test-uid'
3637
name: 'Compute test UID'
3738
run: |-
38-
echo "TEST_UID=${GITHUB_JOB}-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> ${GITHUB_ENV}
39+
echo "TEST_UID=${GITHUB_JOB}-${GITHUB_SHA::7}-${GITHUB_RUN_NUMBER}" >> "${GITHUB_ENV}"
3940
4041
- id: 'set-up-node'
4142
name: 'Set up Node'
4243
uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
4344
with:
44-
node-version: '20.x'
45+
node-version-file: 'package.json'
4546

4647
- id: 'build'
4748
name: 'Build'
@@ -69,7 +70,10 @@ jobs:
6970

7071
- id: 'create-pipeline'
7172
name: 'Create pipeline'
72-
run: 'gcloud deploy apply --file=tests/fixtures/clouddeploy.yaml --region=${REGION}'
73+
run: |-
74+
gcloud deploy apply \
75+
--file="tests/fixtures/clouddeploy.yaml" \
76+
--region="${REGION}"
7377
7478
- id: 'create-release'
7579
name: 'Create release'
@@ -89,9 +93,12 @@ jobs:
8993
9094
- id: 'report-release'
9195
name: 'Report Cloud Deploy release'
96+
env:
97+
RELEASE_NAME: '${{ steps.create-release.outputs.name }}'
98+
RELEASE_LINK: '${{ steps.create-release.outputs.link }}'
9299
run: |-
93-
echo "Created release: ${{ steps.create-release.outputs.name }}"
94-
echo "Release link: ${{ steps.create-release.outputs.link }}"
100+
echo "Created release: ${RELEASE_NAME}"
101+
echo "Release link: ${RELEASE_LINK}"
95102
96103
- id: 'run-e2e-tests'
97104
name: 'Run Tests'

.github/workflows/unit.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ concurrency:
1616
cancel-in-progress: true
1717

1818
jobs:
19+
lint:
20+
uses: 'google-github-actions/.github/.github/workflows/lint.yml@sethvargo/lint' # ratchet:exclude
21+
1922
unit:
2023
strategy:
2124
fail-fast: false
@@ -31,15 +34,16 @@ jobs:
3134

3235
- uses: 'actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a' # ratchet:actions/setup-node@v4
3336
with:
34-
node-version: '20.x'
37+
node-version-file: 'package.json'
3538

3639
- name: 'npm build'
3740
run: 'npm ci && npm run build'
3841

3942
- name: 'npm lint'
4043
# There's no need to run the linter for each operating system, since it
4144
# will find the same thing 3x and clog up the PR review.
42-
if: ${{ matrix.os == 'ubuntu-latest' }}
45+
if: |-
46+
${{ matrix.os == 'ubuntu-latest' }}
4347
run: 'npm run lint'
4448

4549
- name: 'npm test'

action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
name: Create Cloud Deploy Release
16-
author: Google LLC
15+
name: 'Create Cloud Deploy Release'
16+
author: 'Google LLC'
1717
description: |-
1818
Use this action to create a release in Cloud Deploy.
1919
@@ -112,12 +112,12 @@ inputs:
112112

113113
outputs:
114114
name:
115-
description:
115+
description: |-
116116
The full name of the release in Cloud Deploy, including project and
117117
pipeline names, as well as the chosen name of the release itself.
118118
119119
link:
120-
description:
120+
description: |-
121121
A link to the Cloud Deploy release in the Google Cloud Web Console.
122122
123123
branding:

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
"test": "node --require ts-node/register --test-reporter spec --test ./tests/unit/main.test.ts ./tests/unit/output-parser.test.ts",
1111
"e2e-tests": "node --require ts-node/register --test-reporter spec --test ./tests/e2e.test.ts"
1212
},
13+
"engines": {
14+
"node": "20.x",
15+
"npm": "10.x"
16+
},
1317
"repository": {
1418
"type": "git",
1519
"url": "https://github.com/google-github-actions/create-cloud-deploy-release.git"

tests/fixtures/clouddeploy.yaml.template

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ metadata:
1919
description: 'Deployment pipeline for GitHub Action tests'
2020
serialPipeline:
2121
stages:
22-
- targetId: 'gha-test-target'
23-
profiles: ['gha-test']
22+
- targetId: 'gha-test-target'
23+
profiles: ['gha-test']
24+
25+
# yamllint disable-line rule:document-start
2426
---
25-
apiVersion: deploy.cloud.google.com/v1
27+
apiVersion: 'deploy.cloud.google.com/v1'
2628
kind: 'Target'
2729
metadata:
2830
name: 'gha-test-target'

tests/fixtures/gha-test-app.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
template:
2121
spec:
2222
containers:
23-
- name: 'gha-test-app'
24-
image: 'gha-test-app'
23+
- name: 'gha-test-app'
24+
image: 'gha-test-app'
2525
scaling:
2626
maxInstanceCount: '1'

tests/fixtures/skaffold.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ kind: 'Config'
1717
metadata:
1818
name: 'gha-test'
1919
profiles:
20-
- name: 'gha-test'
21-
manifests:
22-
rawYaml:
23-
- 'gha-test-app.yaml'
20+
- name: 'gha-test'
21+
manifests:
22+
rawYaml:
23+
- 'gha-test-app.yaml'
2424
deploy:
2525
cloudrun: {}

0 commit comments

Comments
 (0)