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
|
||||
|
||||
Addresses #1234 (main issue)
|
||||
Addresses # (main issue)
|
||||
|
||||
## Releases
|
||||
|
||||
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.
|
||||
<!--- Add release labels (eg. release/v0) for each target release --->
|
||||
|
||||
## Description
|
||||
|
||||
Describe your change and how it addresses the issue linked above.
|
||||
<!--- Describe your change and how it addresses the issue linked above. --->
|
||||
|
||||
## Testing
|
||||
|
||||
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?
|
||||
<!--- Please describe how you verified this change or why testing isn't relevant. --->
|
||||
|
||||
<!--- 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'
|
||||
run: sleep 10
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- 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:
|
||||
script: |
|
||||
const execSync = require('child_process').execSync;
|
||||
|
|
|
|||
|
|
@ -9,8 +9,30 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
if: ${{ startsWith(github.event.label.name, 'release/v') }}
|
||||
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
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script
|
||||
with:
|
||||
script: |
|
||||
const labelName = context.payload.label.name;
|
||||
|
|
@ -22,18 +44,7 @@ jobs:
|
|||
const parentIssueBody = parentIssue.body;
|
||||
const assignees = ['matttrach', 'jiaqiluo', 'HarrisonWAffel']
|
||||
|
||||
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}`);
|
||||
const prNumber = ${{ steps.extract_pr.outputs.result }};
|
||||
|
||||
// Note: can't get terraform-maintainers team, the default token can't access org level objects
|
||||
// Create the sub-issue
|
||||
|
|
@ -45,10 +56,9 @@ jobs:
|
|||
labels: [labelName],
|
||||
assignees: assignees
|
||||
});
|
||||
|
||||
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', {
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ jobs:
|
|||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script
|
||||
with:
|
||||
script: |
|
||||
const repo = context.repo.repo;
|
||||
|
|
@ -34,7 +34,7 @@ jobs:
|
|||
repo: repo,
|
||||
title: pr.title,
|
||||
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" +
|
||||
"Description copied from PR: \n" + pr.body,
|
||||
labels: newLabels,
|
||||
|
|
@ -50,8 +50,8 @@ jobs:
|
|||
const newSubIssue = await github.rest.issues.create({
|
||||
owner: owner,
|
||||
repo: repo,
|
||||
title: `Backport #${pr.number} to ${releaseLabel}`,
|
||||
body: `Backport #${pr.number} to ${releaseLabel} for #${parentIssueNumber}`,
|
||||
title: `Backport #${pr.number} to ${releaseLabel.name}`,
|
||||
body: `Backport #${pr.number} to ${releaseLabel.name} for #${parentIssueNumber}`,
|
||||
labels: [releaseLabel],
|
||||
assignees: assignees
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
outputs:
|
||||
release_pr: ${{ steps.release-please.outputs.pr }}
|
||||
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
|
||||
id: release-please
|
||||
with:
|
||||
|
|
@ -38,9 +38,9 @@ jobs:
|
|||
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 }}"
|
||||
})
|
||||
- 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
|
||||
- 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
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
|
@ -126,11 +126,11 @@ jobs:
|
|||
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
|
||||
|
||||
# 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
|
||||
with:
|
||||
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
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
name: 'Lint Workflows'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: install-nix
|
||||
|
|
@ -33,7 +33,7 @@ jobs:
|
|||
name: 'Lint Terraform'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: install-nix
|
||||
|
|
@ -52,15 +52,15 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: true
|
||||
- run: go mod download
|
||||
- run: go build -v .
|
||||
- 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:
|
||||
version: latest
|
||||
|
||||
|
|
@ -68,13 +68,13 @@ jobs:
|
|||
generate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
cache: true
|
||||
# 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:
|
||||
terraform_wrapper: false
|
||||
- run: make generate
|
||||
|
|
@ -104,12 +104,12 @@ jobs:
|
|||
- '1.11.*'
|
||||
- '1.12.*'
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
|
||||
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
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:
|
||||
terraform_version: ${{ matrix.terraform }}
|
||||
terraform_wrapper: false
|
||||
|
|
|
|||
Loading…
Reference in New Issue