Skip to content

Commit 9037f08

Browse files
committed
Revert "fix: sync/refresh ordering"
This reverts commit 9f7dece.
1 parent d662a36 commit 9037f08

File tree

5 files changed

+4
-26
lines changed

5 files changed

+4
-26
lines changed

scripts/__tests__/sync.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {GitHub} from '../src/github'
99
import env from '../src/env'
1010
import {Resource} from '../src/resources/resource'
1111
import {RepositoryFile} from '../src/resources/repository-file'
12-
import {refresh} from '../src/refresh'
1312

1413
test('sync', async () => {
1514
const yamlConfig = new config.Config('{}')
@@ -78,10 +77,8 @@ test('sync new repository file', async () => {
7877
const expectedYamlConfig = new config.Config(YAML.stringify(yamlSource))
7978

8079
await sync(tfConfig, yamlConfig)
81-
yamlConfig.format()
82-
expect(yamlConfig.toString().trim()).toEqual('{}')
8380

84-
await refresh(tfConfig, yamlConfig)
8581
yamlConfig.format()
82+
8683
expect(yamlConfig.toString()).toEqual(expectedYamlConfig.toString())
8784
})

scripts/src/actions/fix-yaml-config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ const uninitialisedRepositoryNames = [
1111
]
1212

1313
addFileToAllRepos(
14+
'.github/workflows/stale.yml',
1415
'.github/workflows/stale.yml',
15-
'.github/workflows/stale.yml',
16-
(repository: Repository) =>
17-
!uninitialisedRepositoryNames.includes(repository.name)
16+
(repository: Repository) => !uninitialisedRepositoryNames.includes(repository.name)
1817
)
1918
format()

scripts/src/main.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,14 @@
11
import 'reflect-metadata'
22
import {sync} from './sync'
3-
import {refresh} from './refresh'
43
import {State} from './terraform/state'
54
import {Config} from './yaml/config'
65

76
async function run(): Promise<void> {
87
const state = await State.New()
98
const config = Config.FromPath()
109

11-
// This step calls GitHub API to get the latest state of the world
12-
// and updates the TF state to match. It only updates the resources,
13-
// not their attributes.
1410
await sync(state, config)
15-
config.save()
1611

17-
// This step calls Terraform to get the latest state of the world
18-
// and updates the TF state to match. It updates the resource attributes.
19-
// It requires config to be saved first because it needs to know about
20-
// all the resources.
21-
await refresh(state, config)
2212
config.save()
2313
}
2414

scripts/src/refresh.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

scripts/src/sync.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export async function sync(state: State, config: Config): Promise<void> {
1414
}
1515

1616
await state.sync(resources)
17+
await state.refresh()
1718

1819
const syncedResources = state.getAllResources()
1920
config.sync(syncedResources)

0 commit comments

Comments
 (0)