Skip to content

Commit 0c2d25c

Browse files
authored
Merge pull request #253 from ipfs/master-upgrade
upgrade@20044533896
2 parents 7c96fd8 + 0d5f6d2 commit 0c2d25c

31 files changed

+2552
-209
lines changed

.github/workflows/apply.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,20 @@ jobs:
2323
shell: bash
2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2727
- name: Discover workspaces
2828
id: workspaces
2929
run: echo "this=$(ls github | jq --raw-input '[.[0:-4]]' | jq -sc add)" >> $GITHUB_OUTPUT
30-
- run: npm ci && npm run build
30+
- name: Install pnpm
31+
uses: pnpm/action-setup@v4
32+
with:
33+
version: 10
34+
- name: Use Node.js lts/*
35+
uses: actions/setup-node@v6
36+
with:
37+
node-version: lts/*
38+
cache: ''
39+
- run: pnpm install --frozen-lockfile && pnpm run build
3140
working-directory: scripts
3241
- name: Find sha for plan
3342
id: sha
@@ -65,11 +74,11 @@ jobs:
6574
working-directory: terraform
6675
steps:
6776
- name: Checkout
68-
uses: actions/checkout@v4
77+
uses: actions/checkout@v5
6978
- name: Setup terraform
7079
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
7180
with:
72-
terraform_version: 1.2.9
81+
terraform_version: 1.12.0
7382
terraform_wrapper: false
7483
- name: Initialize terraform
7584
run: terraform init

.github/workflows/clean.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
shell: bash
3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v4
33+
uses: actions/checkout@v5
3434
- name: Discover workspaces
3535
id: workspaces
3636
env:
@@ -69,11 +69,11 @@ jobs:
6969
shell: bash
7070
steps:
7171
- name: Checkout
72-
uses: actions/checkout@v4
72+
uses: actions/checkout@v5
7373
- name: Setup terraform
7474
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
7575
with:
76-
terraform_version: 1.2.9
76+
terraform_version: 1.12.0
7777
terraform_wrapper: false
7878
- name: Initialize terraform
7979
run: terraform init -upgrade

.github/workflows/cleanup.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,18 @@ jobs:
3737
TF_WORKSPACE: ${{ github.repository_owner }}
3838
steps:
3939
- name: Checkout
40-
uses: actions/checkout@v4
40+
uses: actions/checkout@v5
41+
- name: Install pnpm
42+
uses: pnpm/action-setup@v4
43+
with:
44+
version: 10
45+
- name: Use Node.js lts/*
46+
uses: actions/setup-node@v6
47+
with:
48+
node-version: lts/*
49+
cache: ''
4150
- name: Initialize scripts
42-
run: npm install && npm run build
51+
run: pnpm install --frozen-lockfile && pnpm run build
4352
working-directory: scripts
4453
- name: Remove inactive members
4554
run: node lib/actions/remove-inactive-members.js

.github/workflows/fix.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
skip-fix: ${{ steps.skip-fix.outputs.this }}
3636
steps:
3737
- name: Checkout
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@v5
3939
- if: github.event_name == 'pull_request_target'
4040
env:
4141
NUMBER: ${{ github.event.pull_request.number }}
@@ -82,7 +82,7 @@ jobs:
8282
TF_VAR_write_delay_ms: 300
8383
steps:
8484
- name: Checkout
85-
uses: actions/checkout@v4
85+
uses: actions/checkout@v5
8686
- if: github.event_name == 'pull_request_target'
8787
env:
8888
NUMBER: ${{ github.event.pull_request.number }}
@@ -95,13 +95,22 @@ jobs:
9595
- name: Setup terraform
9696
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
9797
with:
98-
terraform_version: 1.2.9
98+
terraform_version: 1.12.0
9999
terraform_wrapper: false
100100
- name: Initialize terraform
101101
run: terraform init
102102
working-directory: terraform
103+
- name: Install pnpm
104+
uses: pnpm/action-setup@v4
105+
with:
106+
version: 10
107+
- name: Use Node.js lts/*
108+
uses: actions/setup-node@v6
109+
with:
110+
node-version: lts/*
111+
cache: ''
103112
- name: Initialize scripts
104-
run: npm ci && npm run build
113+
run: pnpm install --frozen-lockfile && pnpm run build
105114
working-directory: scripts
106115
- name: Fix
107116
id: fix
@@ -117,7 +126,7 @@ jobs:
117126
# NOTE(galargh, 2024-02-15): This will only work if GitHub as Code is used for a single organization
118127
- name: Comment on pull request
119128
if: github.event_name == 'pull_request_target' && steps.fix.outputs.comment
120-
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
129+
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
121130
with:
122131
header: fix
123132
number: ${{ github.event.pull_request.number }}
@@ -142,22 +151,24 @@ jobs:
142151
installation_retrieval_payload: ${{ secrets[format('RW_GITHUB_APP_INSTALLATION_ID_{0}', github.repository_owner)] || secrets.RW_GITHUB_APP_INSTALLATION_ID }}
143152
private_key: ${{ secrets.RW_GITHUB_APP_PEM_FILE }}
144153
- name: Checkout
145-
uses: actions/checkout@v4
154+
uses: actions/checkout@v5
146155
with:
147156
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
148157
ref: ${{ github.event.pull_request.head.sha || github.sha }}
149158
token: ${{ steps.token.outputs.token }}
150159
path: head
151160
- name: Checkout
152-
uses: actions/checkout@v4
161+
uses: actions/checkout@v5
153162
with:
154163
path: base
155164
- name: Download YAML configs
156-
uses: actions/download-artifact@v4
165+
uses: actions/download-artifact@v5
157166
with:
158167
path: artifacts
159168
- name: Copy YAML configs
160-
run: cp artifacts/**/*.yml head/github
169+
run: |
170+
shopt -s globstar
171+
cp artifacts/**/*.yml head/github
161172
- name: Check if github was modified
162173
id: github-modified
163174
run: |

.github/workflows/labels.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,18 @@ jobs:
3535
TF_WORKSPACE: ${{ github.repository_owner }}
3636
steps:
3737
- name: Checkout
38-
uses: actions/checkout@v4
38+
uses: actions/checkout@v5
39+
- name: Install pnpm
40+
uses: pnpm/action-setup@v4
41+
with:
42+
version: 10
43+
- name: Use Node.js lts/*
44+
uses: actions/setup-node@v6
45+
with:
46+
node-version: lts/*
47+
cache: ''
3948
- name: Initialize scripts
40-
run: npm install && npm run build
49+
run: pnpm install --frozen-lockfile && pnpm run build
4150
working-directory: scripts
4251
- name: Sync
4352
run: node lib/actions/sync-labels.js

.github/workflows/plan.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
workspaces: ${{ steps.workspaces.outputs.this }}
2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@v4
28+
uses: actions/checkout@v5
2929
- if: github.event_name == 'pull_request_target'
3030
env:
3131
NUMBER: ${{ github.event.pull_request.number }}
@@ -70,7 +70,7 @@ jobs:
7070
TF_VAR_write_delay_ms: 300
7171
steps:
7272
- name: Checkout
73-
uses: actions/checkout@v4
73+
uses: actions/checkout@v5
7474
- if: github.event_name == 'pull_request_target'
7575
env:
7676
NUMBER: ${{ github.event.pull_request.number }}
@@ -82,7 +82,7 @@ jobs:
8282
- name: Setup terraform
8383
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
8484
with:
85-
terraform_version: 1.2.9
85+
terraform_version: 1.12.0
8686
terraform_wrapper: false
8787
- name: Initialize terraform
8888
run: terraform init
@@ -112,7 +112,7 @@ jobs:
112112
AWS_SECRET_ACCESS_KEY: ${{ secrets.RO_AWS_SECRET_ACCESS_KEY }}
113113
steps:
114114
- name: Checkout
115-
uses: actions/checkout@v4
115+
uses: actions/checkout@v5
116116
- if: github.event_name == 'pull_request_target'
117117
env:
118118
NUMBER: ${{ github.event.pull_request.number }}
@@ -124,13 +124,13 @@ jobs:
124124
- name: Setup terraform
125125
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
126126
with:
127-
terraform_version: 1.2.9
127+
terraform_version: 1.12.0
128128
terraform_wrapper: false
129129
- name: Initialize terraform
130130
run: terraform init
131131
working-directory: terraform
132132
- name: Download terraform plans
133-
uses: actions/download-artifact@v4
133+
uses: actions/download-artifact@v5
134134
with:
135135
path: terraform
136136
- name: Show terraform plans
@@ -157,7 +157,7 @@ jobs:
157157
echo 'EOF' >> $GITHUB_ENV
158158
working-directory: terraform
159159
- name: Comment on pull request
160-
uses: marocchino/sticky-pull-request-comment@67d0dec7b07ed060a405f9b2a64b8ab319fdd7db # v2.9.2
160+
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
161161
with:
162162
header: plan
163163
number: ${{ github.event.pull_request.number }}

.github/workflows/sync.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
description: Whether to acquire terraform state lock during sync
1313
required: false
1414
default: "true"
15+
refresh:
16+
description: Refresh terraform state before sync
17+
required: false
18+
default: "false"
1519

1620
jobs:
1721
prepare:
@@ -24,7 +28,7 @@ jobs:
2428
shell: bash
2529
steps:
2630
- name: Checkout
27-
uses: actions/checkout@v4
31+
uses: actions/checkout@v5
2832
- name: Discover workspaces
2933
id: workspaces
3034
env:
@@ -63,11 +67,11 @@ jobs:
6367
shell: bash
6468
steps:
6569
- name: Checkout
66-
uses: actions/checkout@v4
70+
uses: actions/checkout@v5
6771
- name: Setup terraform
6872
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
6973
with:
70-
terraform_version: 1.2.9
74+
terraform_version: 1.12.0
7175
terraform_wrapper: false
7276
- name: Initialize terraform
7377
run: terraform init -upgrade
@@ -77,15 +81,30 @@ jobs:
7781
terraform workspace select "${TF_WORKSPACE_OPT}" || terraform workspace new "${TF_WORKSPACE_OPT}"
7882
echo "TF_WORKSPACE=${TF_WORKSPACE_OPT}" >> $GITHUB_ENV
7983
working-directory: terraform
84+
- name: Refresh terraform state
85+
if: ${{ github.event.inputs.refresh == 'true' }}
86+
run: |
87+
echo "{}" > $TF_WORKSPACE.tfstate.json
88+
terraform apply -refresh-only -auto-approve -lock=$TF_LOCK
89+
working-directory: terraform
8090
- name: Pull terraform state
8191
run: |
8292
terraform show -json > $TF_WORKSPACE.tfstate.json
8393
working-directory: terraform
94+
- name: Install pnpm
95+
uses: pnpm/action-setup@v4
96+
with:
97+
version: 10
98+
- name: Use Node.js lts/*
99+
uses: actions/setup-node@v6
100+
with:
101+
node-version: lts/*
102+
cache: ''
84103
- name: Sync
85104
run: |
86-
npm ci
87-
npm run build
88-
npm run main
105+
pnpm install --frozen-lockfile
106+
pnpm run build
107+
pnpm run main
89108
working-directory: scripts
90109
- uses: ./.github/actions/git-config-user
91110
- env:
@@ -114,7 +133,7 @@ jobs:
114133
installation_retrieval_payload: ${{ secrets[format('RW_GITHUB_APP_INSTALLATION_ID_{0}', github.repository_owner)] || secrets.RW_GITHUB_APP_INSTALLATION_ID }}
115134
private_key: ${{ secrets.RW_GITHUB_APP_PEM_FILE }}
116135
- name: Checkout
117-
uses: actions/checkout@v4
136+
uses: actions/checkout@v5
118137
with:
119138
token: ${{ steps.token.outputs.token }}
120139
- uses: ./.github/actions/git-config-user

.github/workflows/update.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@ jobs:
2020
run:
2121
shell: bash
2222
steps:
23-
- uses: actions/checkout@v4
24-
- run: npm ci && npm run build
23+
- uses: actions/checkout@v5
24+
- name: Install pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 10
28+
- name: Use Node.js lts/*
29+
uses: actions/setup-node@v6
30+
with:
31+
node-version: lts/*
32+
cache: ''
33+
- run: pnpm install --frozen-lockfile && pnpm run build
2534
working-directory: scripts
2635
- name: Update PRs
2736
env:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
- new args for repositories and branch protection rules
2424

2525
### Changed
26+
- **BREAKING**: added support for efficient labels handling via the `github_issue_labels` resource (please clean `github_issue_label.this.*` from the terraform state and update `locals_override.tf` and `resources_override.tf` before syncing)
27+
- **BREAKING**: upgraded to terraform 1.12.0 and github provider 6.6.0 (please clean `github_branch_protection.this.*` from the terraform state and update `resources_override.tf` before syncing the upgrade)
2628
- **BREAKING**: turned scripts into an ESM project (please ensure you remove the following files during the upgrade: `scripts/.eslintignore`, `scripts/.eslintrc.json`, `scripts/jest.config.js`, `jest.d.ts`, `jest.setup.ts`; please update your imports in the `scripts/src/actions/fix-yaml-config.ts` file to include the `.js` extension)
2729
- **BREAKING**: Updated the signatures of all the shared actions; now the runAction function will persist the changes to disk while action functions will operate on the in-memory state (please update your imports in the `scripts/src/actions/fix-yaml-config.ts` file accordingly)
2830
- Synchronization script: to use GitHub API directly instead of relying on TF GH Provider's Data Sources
@@ -47,8 +49,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4749
- tf: to prevent destroy of membership and repository resources
4850
- apply: find sha for plan using proper credentials
4951
- updated upload and download artifacts actions to v4
52+
- switched from npm to pnpm
5053

5154
### Fixed
55+
- include labels in the config resources only if they are explicitly defined in the config
5256
- always assert state type when creating resources from state
5357
- do not break long file content lines
5458
- source TF_WORKING_DIR from env helper instead of process.env in locals helper

docs/ABOUT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Running the `Sync` GitHub Action workflows refreshes the underlying terraform st
4747
- [github_team_repository](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository)
4848
- [github_team_membership](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_membership)
4949
- [github_repository_file](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/repository_file)
50-
- [github_issue_label](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/issue_label)
50+
- [github_issue_labels](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/issue_labels)
5151

5252
# Config Fix Rules
5353

0 commit comments

Comments
 (0)