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

chore(ci): housekeeping scripts & workflows related to PRs #1023

Merged
merged 6 commits into from
Aug 3, 2022

Conversation

dreamorosi
Copy link
Contributor

@dreamorosi dreamorosi commented Jul 22, 2022

Description of your changes

Scripts

This PR introduces a series of JS scripts under .github/scripts/*. These scripts have been lifted from the Powertools for Python repo.

Workflows

This PR introduces also a few workflows and updates others related to PRs, namely:

  • One single workflow called record_pr.yml is now run as a result of an opened, modified (description/title only - not code), closed PR. This workflow runs and generates an artefact containing the PR details (i.e. title, number, etc.). This artefact is then used by the subsequent workflows.
  • A second workflow called label_pr_on_title.yml is run as result of the successful execution of the record_pr.yml. It uses the generated artefact to obtain the details of the PR (via reusable_export_pr_details.yml) and it labels the PR based on the title. Given that this workflow must have somewhat privileged permissions to label the PR, the new invocation mechanism makes it so that the workflow runs only when called on the original repo (see details here)
  • A third workflow called on_opened_pr.yml is run as result of the successful execution of the record_pr.yml. It uses the generated artefact to obtain the details of the PR (via reusable_export_pr_details.yml) and it tries to find an Issue number in the PR description. PRs that don't have a related issue are then labeled as blocked. This is to avoid having PRs that come without a previous discussion - like detailed in the CONTRIBUTING guidelines.
  • The fourth workflow, called on-merge-to-main.yml already existed and it has now been edited to incorporate a mechanism that labels an issue related to a PR as pending-release.

See diagram below for visual representation of the workflows:

flowchart TB
    A[PR Opened / edited / closed - record_pr.yml runs] -->|Extract PR details - scripts/save_pr_details.js| B[Artifact pr.txt is generated]
    B -->|Label PR| C[label_pr_on_title.yml]
    C -->|Get PR details/artifact - reusable_export_pr_details.yml| D[Adds label to PR if any relevant - label_pr_based_on_title.js]
    B -->|Find related Issue| E[on_opened_pr.yml]
    E -->|Get PR details/artifact - reusable_export_pr_details.yml| F[Adds label only to new PRs if no linked issue is present in PR body - label_missing_related_issue.js]
    B -->|Label related Issue| G[on-merge-to-main.yml]
    G -->|Get PR details/artifact - reusable_export_pr_details.yml| H[Adds label to linked issue when PR is merged - label_related_issue.js]
Loading

Codeowners

The file now points to the team @awslabs/aws-lambda-powertools-typescript that also governs access to the repo.

For additional context, the version of the file present on main had an invalid/outdated format as well as a #todo item with a reminder to change it.

Lerna

The repo has a file called lerna.json, this file is used to specify which packages/folders should be managed by lerna. Previous to this PR all folders under packages/* were included, this PR makes it explicit which folders should be included.

This will come in handy once we start merging PRs that include unreleased utilities or utilities that are not ready to be included as a part of the CI.

PR Template

The section titled Related issues, RFCs has been updated to now point to a single issue with the following format:

<!--- Add here the number to the Github Issue or RFC that is related to this PR. -->
<!-- **Issue number:** #123 -->
**Issue number:** 

This change is aimed at helping the workflow defined above to find the related issue.

How to verify this change

See newly introduced workflows run on PR created/updated/closed

Related issues, RFCs

aws-powertools/powertools-lambda-python#1350
aws-powertools/powertools-lambda-python#1352

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published in downstream module
  • The PR title follows the conventional commit semantics

Breaking change checklist

N/A


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 22, 2022

📊 Package size report   -9.25%↓

File Before After
aws-lambda-powertools-commons-1.0.2.tgz 6.3 kB
commons-bundle.zip 6.8 kB
Total (Includes all files) 142.0 kB -9.25%↓128.8 kB
Tarball size 140.7 kB -9.02%↓128.0 kB
Unchanged files
File Size
aws-lambda-powertools-logger-1.0.2.tgz 24.3 kB
aws-lambda-powertools-metrics-1.0.2.tgz 17.7 kB
aws-lambda-powertools-tracer-1.0.2.tgz 21.6 kB
logger-bundle.zip 24.8 kB
metrics-bundle.zip 18.2 kB
tracer-bundle.zip 22.1 kB

🤖 This report was automatically generated by pkg-size-action
(options hash: 27647e0596d2c826c9298aca55295e28)

@dreamorosi dreamorosi changed the title chore(ci): housekeeping scripts & workflows related to merge chore(ci): housekeeping scripts & workflows related to PRs Jul 23, 2022
@dreamorosi dreamorosi marked this pull request as ready for review July 25, 2022 11:44
@github-actions
Copy link
Contributor

github-actions bot commented Jul 25, 2022

📊 Package size report   No changes

File Before After
Total (Includes all files) 142.0 kB 142.0 kB
Tarball size 140.8 kB -0.02%↓140.7 kB
Unchanged files
File Size
aws-lambda-powertools-commons-1.0.2.tgz 6.3 kB
aws-lambda-powertools-logger-1.0.2.tgz 24.3 kB
aws-lambda-powertools-metrics-1.0.2.tgz 17.7 kB
aws-lambda-powertools-tracer-1.0.2.tgz 21.6 kB
commons-bundle.zip 6.8 kB
logger-bundle.zip 24.8 kB
metrics-bundle.zip 18.2 kB
tracer-bundle.zip 22.1 kB

🤖 This report was automatically generated by pkg-size-action
(options hash: 4ea398bf5ad019fc79f6100561fae75d)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 25, 2022

📊 Package size report   No changes

File Before After
Total (Includes all files) 142.0 kB 142.0 kB
Tarball size 140.8 kB -0%↓140.7 kB
Unchanged files
File Size
aws-lambda-powertools-commons-1.0.2.tgz 6.3 kB
aws-lambda-powertools-logger-1.0.2.tgz 24.3 kB
aws-lambda-powertools-metrics-1.0.2.tgz 17.7 kB
aws-lambda-powertools-tracer-1.0.2.tgz 21.6 kB
commons-bundle.zip 6.8 kB
logger-bundle.zip 24.8 kB
metrics-bundle.zip 18.2 kB
tracer-bundle.zip 22.1 kB

🤖 This report was automatically generated by pkg-size-action
(options hash: 8abc4f9e60d03f25c520a4c170fd475f)

@dreamorosi dreamorosi self-assigned this Jul 25, 2022
@dreamorosi dreamorosi requested review from saragerion, flochaz and ijemmy and removed request for saragerion July 25, 2022 12:00
@dreamorosi dreamorosi added automation This item relates to automation internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) labels Jul 25, 2022
flochaz
flochaz previously approved these changes Jul 26, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 28, 2022

📊 Package size report   No changes

File Before After
Total (Includes all files) 142.0 kB 142.0 kB
Tarball size 140.7 kB 0%↑140.8 kB
Unchanged files
File Size
aws-lambda-powertools-commons-1.0.2.tgz 6.3 kB
aws-lambda-powertools-logger-1.0.2.tgz 24.3 kB
aws-lambda-powertools-metrics-1.0.2.tgz 17.7 kB
aws-lambda-powertools-tracer-1.0.2.tgz 21.6 kB
commons-bundle.zip 6.8 kB
logger-bundle.zip 24.8 kB
metrics-bundle.zip 18.2 kB
tracer-bundle.zip 22.1 kB

🤖 This report was automatically generated by pkg-size-action
(options hash: 60dc61c0cc85859f06ec5fd996ca1eca)

Copy link
Contributor

@ijemmy ijemmy left a comment

Choose a reason for hiding this comment

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

LGTM.

I won't be able to understand these scripts without the PR's description. Would it be beneficial to copy that (including the nice visual diagram) into .github/workflows/README.md?

@dreamorosi
Copy link
Contributor Author

I won't be able to understand these scripts without the PR's description. Would it be beneficial to copy that (including the nice visual diagram) into .github/workflows/README.md?

Very good point, I have created an issue (#1038) to track this action item.

@dreamorosi dreamorosi merged commit 6fe48ba into main Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation This item relates to automation internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants