fix: general workflow improvements (#80)
* fix: update actions and use better PR search * fix: update PR template * fix: sub issue release title --------- Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
parent
5078fdae03
commit
b8de47c589
|
|
@ -1,22 +1,16 @@
|
||||||
## Related Issue
|
## Related Issue
|
||||||
|
|
||||||
Addresses #1234 (main issue)
|
Addresses # (main issue)
|
||||||
|
|
||||||
## Releases
|
<!--- Add release labels (eg. release/v0) for each target release --->
|
||||||
|
|
||||||
If this PR should be released, please add labels for each release branch it targets.
|
|
||||||
Use the 'release/v0' tags, not the 'version/v0' tags.
|
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
Describe your change and how it addresses the issue linked above.
|
<!--- Describe your change and how it addresses the issue linked above. --->
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Please describe how you verified this change or why testing isn't relevant.
|
<!--- Please describe how you verified this change or why testing isn't relevant. --->
|
||||||
|
|
||||||
## Breaking
|
|
||||||
|
|
||||||
Does this change alter an interface that users of the provider will need to adjust to?
|
|
||||||
Will there be any existing configurations broken by this change?
|
|
||||||
|
|
||||||
|
<!--- Does this change alter an interface that users of the provider will need to adjust to? Will there be any existing configurations broken by this change? If so, change the following line with an explanation. --->
|
||||||
|
Not a breaking change.
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ jobs:
|
||||||
- name: 'Wait for merge to settle'
|
- name: 'Wait for merge to settle'
|
||||||
run: sleep 10
|
run: sleep 10
|
||||||
- name: 'Checkout Repository'
|
- name: 'Checkout Repository'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: 'Find Issues and Create Cherry-Pick PRs'
|
- name: 'Find Issues and Create Cherry-Pick PRs'
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const execSync = require('child_process').execSync;
|
const execSync = require('child_process').execSync;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,30 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: ${{ startsWith(github.event.label.name, 'release/v') }}
|
if: ${{ startsWith(github.event.label.name, 'release/v') }}
|
||||||
steps:
|
steps:
|
||||||
|
- name: Find and Verify PR Number
|
||||||
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script
|
||||||
|
id: extract_pr
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const body = context.payload.issue.body;
|
||||||
|
const regex = /#(\d+)/g;
|
||||||
|
const matches = body.matchAll(regex);
|
||||||
|
const potentialNumbers = Array.from(matches, m => m[1]);
|
||||||
|
for (const number of potentialNumbers) {
|
||||||
|
try {
|
||||||
|
const { data: issue } = await github.rest.issues.get({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: number,
|
||||||
|
});
|
||||||
|
if (issue.pull_request) {
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
} catch (error) { /* ignore */ }
|
||||||
|
}
|
||||||
|
core.setFailed('No valid PR found.');
|
||||||
- name: Create GitHub Issue
|
- name: Create GitHub Issue
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const labelName = context.payload.label.name;
|
const labelName = context.payload.label.name;
|
||||||
|
|
@ -22,18 +44,7 @@ jobs:
|
||||||
const parentIssueBody = parentIssue.body;
|
const parentIssueBody = parentIssue.body;
|
||||||
const assignees = ['matttrach', 'jiaqiluo', 'HarrisonWAffel']
|
const assignees = ['matttrach', 'jiaqiluo', 'HarrisonWAffel']
|
||||||
|
|
||||||
if (!parentIssueBody) {
|
const prNumber = ${{ steps.extract_pr.outputs.result }};
|
||||||
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
|
// Note: can't get terraform-maintainers team, the default token can't access org level objects
|
||||||
// Create the sub-issue
|
// Create the sub-issue
|
||||||
|
|
@ -45,10 +56,9 @@ jobs:
|
||||||
labels: [labelName],
|
labels: [labelName],
|
||||||
assignees: assignees
|
assignees: assignees
|
||||||
});
|
});
|
||||||
|
|
||||||
const subIssueId = newIssue.data.id;
|
const subIssueId = newIssue.data.id;
|
||||||
|
|
||||||
// Attach the sub-issue to the parent using API request
|
// Attach the sub-issue to the parent, use REST API because there isn't a github-script API yet.
|
||||||
await github.request('POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues', {
|
await github.request('POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues', {
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/github-script@v7
|
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const repo = context.repo.repo;
|
const repo = context.repo.repo;
|
||||||
|
|
@ -34,7 +34,7 @@ jobs:
|
||||||
repo: repo,
|
repo: repo,
|
||||||
title: pr.title,
|
title: pr.title,
|
||||||
body: "This is the main issue tracking #" + pr.number + " \n\n" +
|
body: "This is the main issue tracking #" + pr.number + " \n\n" +
|
||||||
"Please add labels indicating the release versions eg. 'version/v0' \n\n" +
|
"Please add labels indicating the release versions eg. 'release/v0' \n\n" +
|
||||||
"Please add comments for user issues which this issue addresses. \n\n" +
|
"Please add comments for user issues which this issue addresses. \n\n" +
|
||||||
"Description copied from PR: \n" + pr.body,
|
"Description copied from PR: \n" + pr.body,
|
||||||
labels: newLabels,
|
labels: newLabels,
|
||||||
|
|
@ -50,8 +50,8 @@ jobs:
|
||||||
const newSubIssue = await github.rest.issues.create({
|
const newSubIssue = await github.rest.issues.create({
|
||||||
owner: owner,
|
owner: owner,
|
||||||
repo: repo,
|
repo: repo,
|
||||||
title: `Backport #${pr.number} to ${releaseLabel}`,
|
title: `Backport #${pr.number} to ${releaseLabel.name}`,
|
||||||
body: `Backport #${pr.number} to ${releaseLabel} for #${parentIssueNumber}`,
|
body: `Backport #${pr.number} to ${releaseLabel.name} for #${parentIssueNumber}`,
|
||||||
labels: [releaseLabel],
|
labels: [releaseLabel],
|
||||||
assignees: assignees
|
assignees: assignees
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ jobs:
|
||||||
outputs:
|
outputs:
|
||||||
release_pr: ${{ steps.release-please.outputs.pr }}
|
release_pr: ${{ steps.release-please.outputs.pr }}
|
||||||
steps:
|
steps:
|
||||||
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0 https://github.com/googleapis/release-please-action/commits/main/
|
- uses: googleapis/release-please-action@c2a5a2bd6a758a0937f1ddb1e8950609867ed15c # v4.3.0 https://github.com/googleapis/release-please-action/commits/main/
|
||||||
name: release-please
|
name: release-please
|
||||||
id: release-please
|
id: release-please
|
||||||
with:
|
with:
|
||||||
|
|
@ -38,9 +38,9 @@ jobs:
|
||||||
repo: "${{ github.event.repository.name }}",
|
repo: "${{ github.event.repository.name }}",
|
||||||
body: "Please make sure e2e tests pass before merging this PR! \n ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
body: "Please make sure e2e tests pass before merging this PR! \n ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||||
})
|
})
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
if: steps.release-please.outputs.pr
|
if: steps.release-please.outputs.pr
|
||||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||||
if: steps.release-please.outputs.pr
|
if: steps.release-please.outputs.pr
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
|
|
@ -126,11 +126,11 @@ jobs:
|
||||||
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
|
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
|
||||||
|
|
||||||
# These run after release-please generates a release, so when the release PR is merged
|
# These run after release-please generates a release, so when the release PR is merged
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
if: steps.release-please.outputs.version
|
if: steps.release-please.outputs.version
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||||
if: steps.release-please.outputs.version
|
if: steps.release-please.outputs.version
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ jobs:
|
||||||
name: 'Lint Workflows'
|
name: 'Lint Workflows'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: install-nix
|
- name: install-nix
|
||||||
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
name: 'Lint Terraform'
|
name: 'Lint Terraform'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: install-nix
|
- name: install-nix
|
||||||
|
|
@ -52,15 +52,15 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
cache: true
|
cache: true
|
||||||
- run: go mod download
|
- run: go mod download
|
||||||
- run: go build -v .
|
- run: go build -v .
|
||||||
- name: Run linters
|
- name: Run linters
|
||||||
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
|
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0 https://github.com/golangci/golangci-lint-action
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
|
|
@ -68,13 +68,13 @@ jobs:
|
||||||
generate:
|
generate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
cache: true
|
cache: true
|
||||||
# We need the latest version of Terraform for our documentation generation to use
|
# We need the latest version of Terraform for our documentation generation to use
|
||||||
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
|
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 https://github.com/hashicorp/setup-terraform
|
||||||
with:
|
with:
|
||||||
terraform_wrapper: false
|
terraform_wrapper: false
|
||||||
- run: make generate
|
- run: make generate
|
||||||
|
|
@ -104,12 +104,12 @@ jobs:
|
||||||
- '1.11.*'
|
- '1.11.*'
|
||||||
- '1.12.*'
|
- '1.12.*'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||||
with:
|
with:
|
||||||
go-version-file: 'go.mod'
|
go-version-file: 'go.mod'
|
||||||
cache: true
|
cache: true
|
||||||
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
|
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 https://github.com/hashicorp/setup-terraform
|
||||||
with:
|
with:
|
||||||
terraform_version: ${{ matrix.terraform }}
|
terraform_version: ${{ matrix.terraform }}
|
||||||
terraform_wrapper: false
|
terraform_wrapper: false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue