Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(.github/action): add release-candidate-ready-for-qa GitHub action #144

Merged
merged 8 commits into from
Apr 4, 2024

Conversation

maksym-shynkarenko
Copy link
Contributor

@maksym-shynkarenko maksym-shynkarenko commented Mar 19, 2024

Add the GitHub Action release-candidate-ready-for-qa

Closes: #426

@maksym-shynkarenko maksym-shynkarenko requested a review from a team as a code owner March 19, 2024 11:46
@CLAassistant
Copy link

CLAassistant commented Mar 19, 2024

CLA assistant check
All committers have signed the CLA.

| Name | Required | Description | Default |
| --------------- | -------- | ---------------------------------------------------------- | ------- |
| `version` | Yes | A version of the release candidate | NA |
| `revision-url` | Yes | A commit revision URL | NA |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be hardcoded into the action but instead derived. It should use the current SHA of the release branch to get the build id as the SHA is used in the build name (for example https://github.com/dequelabs/axe-core-npm/blob/develop/.github/workflows/deploy.yml#L62).

The final build name should be: the package name and version, followed by rc and the SHA.

For example, if @axe-core/puppeteer were to deploy an RC for version 4.9.0 and the current release brach SHA was 726e3c4, the final name of the build QA should use is:

axe-core/puppeteer-4.9.0-rc-726e3c4


| Name | Required | Description | Default |
| --------------- | -------- | ---------------------------------------------------------- | ------- |
| `version` | Yes | A version of the release candidate | NA |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be hardcoded as the version changes every deploy. It will need to be taken from the package/lerna.json of the release brach.

It should use #115. Since this is the 3rd time we've needed to use this script we should create that action first, merge it, then bring it into this action to use.

| --------------- | -------- | ---------------------------------------------------------- | ------- |
| `version` | Yes | A version of the release candidate | NA |
| `revision-url` | Yes | A commit revision URL | NA |
| `owner` | Yes | An owner of the repository | NA |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the same wording and requirement as

| `owner` | No | The owner of the repository e.g. dequelabs/axe-core-npm, then supply "dequelabs" | `github.context.repo.owner` |
.

Suggested change
| `owner` | Yes | An owner of the repository | NA |
| `owner` | No | The owner of the repository e.g. dequelabs/axe-core-npm, then supply "dequelabs" | `github.context.repo.owner` |

| `version` | Yes | A version of the release candidate | NA |
| `revision-url` | Yes | A commit revision URL | NA |
| `owner` | Yes | An owner of the repository | NA |
| `repo` | Yes | A repository name | NA |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the same wording and requirements as

| `repo` | No | The repository e.g. dequelabs/axe-core-npm, then supply "axe-core-npm" | `github.context.repo.repo` |

Suggested change
| `repo` | Yes | A repository name | NA |
| `repo` | No | The repository e.g. dequelabs/axe-core-npm, then supply "axe-core-npm" | `github.context.repo.repo` |

| `owner` | Yes | An owner of the repository | NA |
| `repo` | Yes | A repository name | NA |
| `slack-webhook` | Yes | A Slack channel webhook URL where the message will be sent | NA |
| `slack-channel` | No | A Slack channel name where the message will be sent | NA |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably fine to hardcode into the action. I don't think we should be posting these release candidate build messages to different slack channels so shouldn't give the user an option. We can change that in the future if that ever happens and just have this default to api-team-releases.

Comment on lines 37 to 40
if [[ -z "${{ steps.get-release-issue.outputs.issue-url }}" ]]; then
echo "::error::No release issue has been found"
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you're trying to exit early if no ticket is found? If so you should use the gh run commands to do that

gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}

https://stackoverflow.com/a/75809743/2124254

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed with @straker we leave the original code because it shows the correct error message

@straker
Copy link
Contributor

straker commented Mar 19, 2024

Forgot to mention, we should rename this action since it does not deploy anything, just moves tickets around and posts to slack. So maybe post-deploy-release-candidate or announce-deploy-release-candidate? @Zidious @michael-siek any thoughts on the naming?

@michael-siek
Copy link
Member

I think deploy-release-candidate-notification would be good

@Zidious
Copy link
Contributor

Zidious commented Mar 19, 2024

Forgot to mention, we should rename this action since it does not deploy anything, just moves tickets around and posts to slack. So maybe post-deploy-release-candidate or announce-deploy-release-candidate? @Zidious @michael-siek any thoughts on the naming?

The ones you and Michael suggested sound more like the name we should move too, I think its better if we remove deploy though, then maybe announce-release-candidate? Other possible names:

  • move-release-candidate
  • qa-release-candidate
  • release-candidate-merged

@straker
Copy link
Contributor

straker commented Mar 21, 2024

release-candidate-ready-for-qa

@maksym-shynkarenko maksym-shynkarenko changed the title ci(.github/action): add deploy-release-candidate GitHub action ci(.github/action): add release-candidate-ready-for-qa GitHub action Mar 26, 2024
- uses: actions/checkout@v4
- uses: dequelabs/axe-api-team-public/.github/actions/release-candidate-ready-for-qa-v1-v1@main
with:
sha-rc: 4b632c61
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be an input, it should be calculated using the release branch sha.

git checkout release
git rev-parse --short HEAD

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a branch name should not be hardcoded. A workflow file should take responsibility for the branch name where this action is called

Comment on lines 21 to 38
- name: Get owner and repository name
id: get-owner-repo-name
shell: bash
run: |
if [[ -n "${{ inputs.owner }}" ]]; then
ORGANIZATION="${{ inputs.owner }}"
else
IFS='/' read -r ORGANIZATION _ <<< "$GITHUB_REPOSITORY"
fi

if [[ -n "${{ inputs.repo }}" ]]; then
REPOSITORY="${{ inputs.repo }}"
else
IFS='/' read -r _ REPOSITORY <<< "$GITHUB_REPOSITORY"
fi

echo "owner=$ORGANIZATION" >> $GITHUB_OUTPUT
echo "repo=$REPOSITORY" >> $GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to do this. repo and owner have default values in https://github.com/dequelabs/axe-api-team-public/blob/main/.github/actions/get-release-issue-v1/src/run.ts#L8-L9 so you can just forward the repo and owner inputs directly and let the release issue action use the defaults if none are provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the get-release-issue-v1 these are optional params so I leave it as in that action. Also, the repo name is used for adding a comment to an issue https://github.com/dequelabs/axe-api-team-public/blob/ci-add-deploy-release-candidate/.github/actions/release-candidate-ready-for-qa-v1/action.yml#L63

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since GH_REPO is not needed to add a comment since we provide the issue url, this step is not needed and can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, I will remove inputs.owner, inputs.repo because they are not needed

@maksym-shynkarenko maksym-shynkarenko dismissed straker’s stale review April 3, 2024 11:53

changed according to the review

straker
straker previously requested changes Apr 3, 2024
@@ -0,0 +1,33 @@
# release-candidate-ready-for-qa-v1

A GitHub Action to prepare already created a release candidate for QA.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
A GitHub Action to prepare already created a release candidate for QA.
A GitHub Action that lets the QA team know a release candidate is ready for QA


| Name | Required | Description | Default |
| --------------- | -------- | ---------------------------------------------------------- | ---------------------------- |
| `sha-rc` | No | SHA of the release commit from the release branch | git rev-parse --short=8 HEAD |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to specify the length since SHA could be short (8) or long (40)

Suggested change
| `sha-rc` | No | SHA of the release commit from the release branch | git rev-parse --short=8 HEAD |
| `sha-rc` | No | 8 character SHA of the release commit from the release branch | git rev-parse --short=8 HEAD |

| --------------- | -------- | ---------------------------------------------------------- | ---------------------------- |
| `sha-rc` | No | SHA of the release commit from the release branch | git rev-parse --short=8 HEAD |
| `slack-webhook` | Yes | A Slack channel webhook URL where the message will be sent | NA |
| `owner` | No | An owner of the repository | $GITHUB_REPOSITORY |
Copy link
Contributor

@straker straker Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should match the text in the action.yml

Suggested change
| `owner` | No | An owner of the repository | $GITHUB_REPOSITORY |
| `owner` | No | The owner of the repository e.g. dequelabs/axe-core-npm, then supply "dequelabs" | $GITHUB_REPOSITORY |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this because it's not needed

| `sha-rc` | No | SHA of the release commit from the release branch | git rev-parse --short=8 HEAD |
| `slack-webhook` | Yes | A Slack channel webhook URL where the message will be sent | NA |
| `owner` | No | An owner of the repository | $GITHUB_REPOSITORY |
| `repo` | No | A repository name | $GITHUB_REPOSITORY |
Copy link
Contributor

@straker straker Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should match the text in the action.yml

Suggested change
| `repo` | No | A repository name | $GITHUB_REPOSITORY |
| `repo` | No | The repository e.g. dequelabs/axe-core-npm, then supply "axe-core-npm" | $GITHUB_REPOSITORY |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this because it's not needed

Comment on lines +23 to +24
permissions:
issues: write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since write permissions are needed (I assume for gh issue comment command to write a comment), we should spell that out similar to how we've listed permissions in other repos

@@ -0,0 +1,98 @@
name: release-candidate-ready-for-qa-v1
description: Preparing a release candidate issue for QA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: Preparing a release candidate issue for QA
description: Lets the QA team know a release candidate is ready for QA


inputs:
sha-rc:
description: SHA of the release commit from the release branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: SHA of the release commit from the release branch
description: 8 character SHA of the release commit from the release branch

shell: bash
run: gh issue comment ${{ steps.get-release-issue.outputs.issue-url }} --body "$BODY"
env:
GH_REPO: ${{ steps.get-owner-repo-name.outputs.repo }}
Copy link
Contributor

@straker straker Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GH_REPO is only needed if you don't supply a url (i.e. use an issue number). Since we provide the url the repo is parsed from that. Testing in my terminal this works

GH_TOKEN=<token> gh issue comment https://github.com/dequelabs/<repo>/issues/<number> -b "hello world"
Suggested change
GH_REPO: ${{ steps.get-owner-repo-name.outputs.repo }}

Comment on lines 21 to 38
- name: Get owner and repository name
id: get-owner-repo-name
shell: bash
run: |
if [[ -n "${{ inputs.owner }}" ]]; then
ORGANIZATION="${{ inputs.owner }}"
else
IFS='/' read -r ORGANIZATION _ <<< "$GITHUB_REPOSITORY"
fi

if [[ -n "${{ inputs.repo }}" ]]; then
REPOSITORY="${{ inputs.repo }}"
else
IFS='/' read -r _ REPOSITORY <<< "$GITHUB_REPOSITORY"
fi

echo "owner=$ORGANIZATION" >> $GITHUB_OUTPUT
echo "repo=$REPOSITORY" >> $GITHUB_OUTPUT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since GH_REPO is not needed to add a comment since we provide the issue url, this step is not needed and can be removed.

…candidate-ready-for-qa-v1 action. Change the Readme file of this action
@maksym-shynkarenko maksym-shynkarenko dismissed straker’s stale review April 4, 2024 12:59

changed according to the review

Copy link
Contributor

@straker straker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maksym-shynkarenko showed me the results of testing it in a test repo with release-like issues so we should be good to merge. We'll do another test once this is merged to verify in actual codebase.

@maksym-shynkarenko maksym-shynkarenko merged commit 055c6e4 into main Apr 4, 2024
15 checks passed
@maksym-shynkarenko maksym-shynkarenko deleted the ci-add-deploy-release-candidate branch April 4, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants