diff --git a/.github/terraform-maintainers b/.github/terraform-maintainers new file mode 100644 index 0000000..84f609a --- /dev/null +++ b/.github/terraform-maintainers @@ -0,0 +1,3 @@ +matttrach +jiaqiluo +HarrisonWAffel diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 79469a8..a3b0404 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -18,16 +18,38 @@ jobs: const parentIssueNumber = parentIssue.number; const repo = context.repo.repo; const owner = context.repo.owner; + const parentIssueBody = parentIssue.body; + + const fs = require('fs'); // Import the Node.js file system module + const fileContent = fs.readFileSync('.github/terraform-maintainers', 'utf8'); + const assignees = fileContent.split('\n').map(u => u.trim()).filter(Boolean); + if (assignees.length === 0) { + console.log('No assignees found in the team file.'); + return; + } + + if (!parentIssueBody) { + core.setFailed('Issue body is empty.'); + return; + } + const regex = /https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)/; + const match = parentIssueBody.match(regex); + if (!match) { + core.setFailed('Could not find a PR link in the issue body.'); + return; + } + const prNumber = match[1]; + console.log(`Found PR Number: ${prNumber}`); // Note: can't get terraform-maintainers team, the default token can't access org level objects // Create the sub-issue const newIssue = await github.rest.issues.create({ owner: owner, repo: repo, - title: "Backport #" + parentIssueNumber + " to release/v0", - body: "Backport #" + parentIssueNumber + " to release/v0", + title: `Backport #${prNumber} to release/v0`, + body: `Backport #${prNumber} to release/v0 for #${parentIssueNumber}`, labels: ['release/v0'], - assignees: ['matttrach'] + assignees: assignees }); const subIssueId = newIssue.data.id; diff --git a/.github/workflows/main-issue.yml b/.github/workflows/main-issue.yml index 5ca0bd9..2a8d2cc 100644 --- a/.github/workflows/main-issue.yml +++ b/.github/workflows/main-issue.yml @@ -24,6 +24,14 @@ jobs: const versionLabel = releaseLabel.name.replace('release/', 'version/'); newLabels.push(versionLabel); } + const fs = require('fs'); // Import the Node.js file system module + const fileContent = fs.readFileSync('.github/terraform-maintainers', 'utf8'); + const assignees = fileContent.split('\n').map(u => u.trim()).filter(Boolean); + if (assignees.length === 0) { + console.log('No assignees found in the team file.'); + return; + } + // Note: can't get terraform-maintainers team, the default token can't access org level objects // Create the main issue // https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue @@ -37,10 +45,10 @@ jobs: "Please add comments for user issues which this issue addresses. \n\n" + "Description copied from PR: \n" + pr.body, labels: newLabels, - assignees: ['matttrach'] + assignees: assignees }); if (releaseLabel) { - // if version label detected, then add appropriate sub-issues + // if release label detected, then add appropriate sub-issues const parentIssue = newIssue.data; const parentIssueTitle = parentIssue.title; const parentIssueNumber = parentIssue.number; @@ -49,10 +57,10 @@ jobs: const newSubIssue = await github.rest.issues.create({ owner: owner, repo: repo, - title: "Backport #" + parentIssueNumber + " to release/v0", - body: "Backport #" + parentIssueNumber + " to release/v0", + title: `Backport #${pr.number} to release/v0`, + body: `Backport #${pr.number} to release/v0 for #${parentIssueNumber}`, labels: ['release/v0'], - assignees: ['matttrach'] + assignees: assignees }); const subIssueId = newSubIssue.data.id; // Attach the sub-issue to the parent using API request diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ade2da1..f0a959c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,9 +90,9 @@ jobs: uses: rancher-eio/read-vault-secrets@main with: secrets: | - secret/data/github/repo/rancher/${{ github.repository }}/signing/gpg passphrase | GPG_PASSPHRASE ; - secret/data/github/repo/rancher/${{ github.repository }}/signing/gpg privateKeyId | GPG_KEY_ID ; - secret/data/github/repo/rancher/${{ github.repository }}/signing/gpg privateKey | GPG_KEY + secret/data/github/repo/${{ github.repository }}/signing/gpg passphrase | GPG_PASSPHRASE ; + secret/data/github/repo/${{ github.repository }}/signing/gpg privateKeyId | GPG_KEY_ID ; + secret/data/github/repo/${{ github.repository }}/signing/gpg privateKey | GPG_KEY - name: import_gpg_key if: steps.release-please.outputs.pr && (steps.run-unit-tests.conclusion == 'success') env: @@ -134,12 +134,13 @@ jobs: go-version-file: 'go.mod' cache: true - name: retrieve GPG Credentials + if: steps.release-please.outputs.version uses: rancher-eio/read-vault-secrets@main with: secrets: | - secret/data/github/repo/rancher/${{ github.repository }}/signing/gpg passphrase | GPG_PASSPHRASE ; - secret/data/github/repo/rancher/${{ github.repository }}/signing/gpg privateKeyId | GPG_KEY_ID ; - secret/data/github/repo/rancher/${{ github.repository }}/signing/gpg privateKey | GPG_KEY + secret/data/github/repo/${{ github.repository }}/signing/gpg passphrase | GPG_PASSPHRASE ; + secret/data/github/repo/${{ github.repository }}/signing/gpg privateKeyId | GPG_KEY_ID ; + secret/data/github/repo/${{ github.repository }}/signing/gpg privateKey | GPG_KEY - name: import_gpg_key if: steps.release-please.outputs.version env: diff --git a/aspell_custom.txt b/aspell_custom.txt index e14e570..690469b 100644 --- a/aspell_custom.txt +++ b/aspell_custom.txt @@ -15,3 +15,4 @@ pr assignees backport url +gpg diff --git a/flake.lock b/flake.lock index af58f08..3476040 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1755577059, - "narHash": "sha256-5hYhxIpco8xR+IpP3uU56+4+Bw7mf7EMyxS/HqUYHQY=", + "lastModified": 1756035328, + "narHash": "sha256-vC7SslUBCtdT3T37ZH3PLIWYmTkSeppL5BJJByUjYCM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "97eb7ee0da337d385ab015a23e15022c865be75c", + "rev": "6b0b1559e918d4f7d1df398ee1d33aeac586d4d6", "type": "github" }, "original": {