Skip to content

Commit 81e7aa0

Browse files
authored
Merge pull request #142 from github/no-ci-check-fixes
CI Status Check Fixes
2 parents 334a297 + 1d75856 commit 81e7aa0

File tree

10 files changed

+243
-9055
lines changed

10 files changed

+243
-9055
lines changed

.github/workflows/actions-config-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
actions-config-validation:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v3.5.0
17+
- uses: actions/checkout@v3
1818

1919
- name: actions-config-validation
20-
uses: GrantBirki/json-yaml-validate@78e22e5c6549059f267f96aea1aaf97132896c04 # [email protected].0
20+
uses: GrantBirki/json-yaml-validate@9a228501b1e80369c582764187fbefdc2f7fbac1 # [email protected].1
2121
with:
2222
comment: "true" # enable comment mode
2323
yaml_schema: "__tests__/schemas/action.schema.yml"

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
steps:
2828
- name: checkout
29-
uses: actions/checkout@v3.5.0
29+
uses: actions/checkout@v3
3030

3131
# Initializes the CodeQL tools for scanning.
3232
- name: Initialize CodeQL

.github/workflows/lint.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,12 @@ jobs:
1313
lint:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/[email protected]
17-
18-
# check the node version from the .node-version file
19-
- name: fetch node version
20-
id: node-version
21-
run: |
22-
version=$(cat .node-version)
23-
echo "version=${version}" >> $GITHUB_OUTPUT
16+
- uses: actions/checkout@v3
2417

2518
- name: setup node
2619
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
2720
with:
28-
node-version: ${{ steps.node-version.outputs.version }}
21+
node-version-file: .node-version
2922
cache: 'npm'
3023

3124
- name: install dependencies

.github/workflows/package-check.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,21 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/[email protected]
16-
17-
# check the node version from the .node-version file
18-
- name: fetch node version
19-
id: node-version
20-
run: |
21-
version=$(cat .node-version)
22-
echo "version=${version}" >> $GITHUB_OUTPUT
15+
- uses: actions/checkout@v3
2316

2417
- name: setup node
2518
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
2619
with:
27-
node-version: ${{ steps.node-version.outputs.version }}
20+
node-version-file: .node-version
2821
cache: 'npm'
2922

3023
- name: install dependencies
3124
run: npm ci
3225

33-
- name: Rebuild the dist/ directory
26+
- name: rebuild the dist/ directory
3427
run: npm run bundle
3528

36-
- name: Compare the expected and actual dist/ directories
29+
- name: compare the expected and actual dist/ directories
3730
run: |
3831
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
3932
echo "Detected uncommitted changes after build. See status below:"

.github/workflows/test.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,12 @@ jobs:
1313
test:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/[email protected]
17-
18-
# check the node version from the .node-version file
19-
- name: fetch node version
20-
id: node-version
21-
run: |
22-
version=$(cat .node-version)
23-
echo "version=${version}" >> $GITHUB_OUTPUT
16+
- uses: actions/checkout@v3
2417

2518
- name: setup node
2619
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # [email protected]
2720
with:
28-
node-version: ${{ steps.node-version.outputs.version }}
21+
node-version-file: .node-version
2922
cache: 'npm'
3023

3124
- name: install dependencies

__tests__/functions/prechecks.test.js

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,11 @@ test('runs prechecks and finds that the IssueOps command is valid without define
215215
)
216216
).toStrictEqual({
217217
message:
218-
'### ⚠️ Cannot proceed with deployment\n\n- reviewDecision: `APPROVED`\n- commitStatus: `null`\n\n> This is usually caused by missing PR approvals or CI checks failing',
219-
status: false
218+
'✔️ CI checks have not been defined but the PR has been approved - OK',
219+
status: true,
220+
noopMode: false,
221+
ref: 'test-ref',
222+
sha: 'abc123'
220223
})
221224
expect(infoMock).toHaveBeenCalledWith(
222225
"Could not retrieve PR commit status: TypeError: Cannot read properties of undefined (reading 'nodes') - Handled: OK"
@@ -934,6 +937,39 @@ test('runs prechecks and finds the PR is NOT reviewed and CI checks have NOT bee
934937
})
935938
})
936939

940+
test('runs prechecks and finds the PR is approved and CI checks have NOT been defined and NOT a noop deploy', async () => {
941+
octokit.graphql = jest.fn().mockReturnValue({
942+
repository: {
943+
pullRequest: {
944+
reviewDecision: 'APPROVED'
945+
}
946+
}
947+
})
948+
expect(
949+
await prechecks(
950+
'.deploy',
951+
'.deploy',
952+
'noop',
953+
'disabled',
954+
'main',
955+
'123',
956+
true,
957+
'',
958+
'',
959+
'production',
960+
context,
961+
octokit
962+
)
963+
).toStrictEqual({
964+
message:
965+
'✔️ CI checks have not been defined but the PR has been approved - OK',
966+
status: true,
967+
noopMode: false,
968+
ref: 'test-ref',
969+
sha: 'abc123'
970+
})
971+
})
972+
937973
test('runs prechecks and finds the PR is behind the stable branch and a noop deploy and force updates the branch', async () => {
938974
octokit.graphql = jest.fn().mockReturnValue({
939975
repository: {

dist/index.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)