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

Migrated codebase to work as an action #48

Merged
merged 12 commits into from
Jan 17, 2023

Conversation

Bullrich
Copy link
Contributor

@Bullrich Bullrich commented Jan 16, 2023

Updated codebase to run as an action instead of a application.

This PR mainly removes most of the boilerplate and code unrelated to the action itself and adapts everything to work in a more organized and abstract way.

It splits the architecture into an object oriented dependency injection system, having the class Synchronizer handling all the business logic and the classes ProjectKit,IssueKit and CoreLogger handling specific subtasks.

To be able to fine-grain the project permissions and keep the highest level of security possible while maintaining a sane codebase, the action of each token has been split into its own class:

  • ProjectKit uses a PAT with organization access as it needs to interact with the project API (which is part of an organization instead of a repository).
  • IssueKit uses the autogenerated GitHub token to fetch information from the issues API available in the repository.

ProjectKit is still in development, as it's missing the ability to update custom fields (#44) and it's using a deprecated API (#46) so it's prone to changes in the following PRs.

This PR is aimed at a feature branch and not at the master branch. The reason for this is because this task does not contemplate all the necessary features to launch this action. This is the first task of many which can be found in the milestone: GitHub Action port. Once all this tasks have been completed, the feature branch will be merged into master replacing the current functionality.

This PR also removes the ability to use custom labeling and custom fields. This will be added later to the feature branch.

The action was ported to work as a Docker image instead of a JavaScript image. This is because the docker image allows to build the action on demand (currently ~45 seconds). A more efficient method will be proposed later but for the current development process this satisfies the requirements.

This PR resolves #43.

Created the root of the action with a dockerfile so it can be built and easily tested
Created the required classes and wrapper for the system to handle project management and issue management.
Cleaned up old logs from the tests
@Bullrich Bullrich added documentation Improvements or additions to documentation enhancement New feature or request labels Jan 16, 2023
@Bullrich Bullrich added this to the GitHub Action port milestone Jan 16, 2023
@Bullrich Bullrich requested a review from a team as a code owner January 16, 2023 17:22
@Bullrich Bullrich self-assigned this Jan 16, 2023
@Bullrich Bullrich requested a review from a team as a code owner January 16, 2023 17:22
@Bullrich Bullrich enabled auto-merge (squash) January 16, 2023 17:30
@mutantcornholio
Copy link
Contributor

This PR is aimed at a feature branch and not at the master branch. The reason for this is because this task does not contemplate all the necessary features to launch this action. This is the first task of many which can be found in the milestone: GitHub Action port. Once all this tasks have been completed, the feature branch will be merged into master replacing the current functionality.

Soo, should we also review the code in the feature branch then? Or was it reviewed already?

@Bullrich
Copy link
Contributor Author

Soo, should we also review the code in the feature branch then? Or was it reviewed already?

No, as there are no changes. The feature branch has just been created for this PR. It's currently up to date with master so there isn't anything new in it.

@mutantcornholio
Copy link
Contributor

Ah, I was probably looking at the head branch, thinking it's the base...

@@ -1 +0,0 @@
module.exports = require("opstooling-js-style/src/prettier/configuration")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need this one back

},
},
],
};
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, I think the codestyle config is still needed

- name: Install dependencies
run: yarn install --immutable
- name: Run tests
run: yarn test
Copy link
Contributor

Choose a reason for hiding this comment

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

Also, codestyle integration here is missing

@mutantcornholio
Copy link
Contributor

mutantcornholio commented Jan 17, 2023

Other than that, looks good

@Bullrich
Copy link
Contributor Author

@mutantcornholio I'm planning on adding the linting rules again but in a different issue #47.

Can we wait until that PR?

@mutantcornholio
Copy link
Contributor

@mutantcornholio I'm planning on adding the linting rules again but in a different issue #47.

Can we wait until that PR?

Doesn't feel like something out of scope, but sure

@Bullrich Bullrich merged commit 5ef3cea into paritytech:bullrich/migrate-to-action Jan 17, 2023
@Bullrich Bullrich deleted the action-port branch January 17, 2023 13:29
Bullrich added a commit that referenced this pull request Mar 20, 2023
Updated codebase to run as an action instead of a application.

This PR mainly removes most of the boilerplate and code unrelated to the action itself and adapts everything to work in a more organized and abstract way.

It splits the architecture into an object oriented dependency injection system, having the class `Synchronizer` handling all the business logic and the classes `ProjectKit`,`IssueKit` and `CoreLogger` handling specific subtasks.

To be able to fine-grain the project permissions and keep the highest level of security possible while maintaining a sane codebase, the action of each token has been split into its own class:
- ProjectKit uses a PAT with organization access as it needs to interact with the project API (which is part of an organization instead of a repository).
- IssueKit uses the autogenerated GitHub token to fetch information from the issues API available in the repository.

`ProjectKit` is still in development, as it's missing the ability to update custom fields (#44) and it's using a deprecated API (#46) so it's prone to changes in the following PRs.

This PR is aimed at a feature branch and not at the master branch. The reason for this is because this task does not contemplate all the necessary features to launch this action. This is the first task of many which can be found in the milestone: [GitHub Action port](https://github.com/paritytech/github-issue-sync/milestone/1). Once all this tasks have been completed, the feature branch will be merged into master replacing the current functionality.

This PR also removes the ability to use custom labeling and custom fields. This will be added later to the feature branch.

The action was ported to work as a Docker image instead of a JavaScript image. This is because the docker image allows to build the action on demand (currently ~45 seconds). A more efficient method will be proposed later but for the current development process this satisfies the requirements.

This PR resolves #43.
Bullrich added a commit that referenced this pull request Mar 21, 2023
Updated codebase to run as an action instead of a application.

This PR mainly removes most of the boilerplate and code unrelated to the action itself and adapts everything to work in a more organized and abstract way.

It splits the architecture into an object oriented dependency injection system, having the class `Synchronizer` handling all the business logic and the classes `ProjectKit`,`IssueKit` and `CoreLogger` handling specific subtasks.

To be able to fine-grain the project permissions and keep the highest level of security possible while maintaining a sane codebase, the action of each token has been split into its own class:
- ProjectKit uses a PAT with organization access as it needs to interact with the project API (which is part of an organization instead of a repository).
- IssueKit uses the autogenerated GitHub token to fetch information from the issues API available in the repository.

`ProjectKit` is still in development, as it's missing the ability to update custom fields (#44) and it's using a deprecated API (#46) so it's prone to changes in the following PRs.

This PR is aimed at a feature branch and not at the master branch. The reason for this is because this task does not contemplate all the necessary features to launch this action. This is the first task of many which can be found in the milestone: [GitHub Action port](https://github.com/paritytech/github-issue-sync/milestone/1). Once all this tasks have been completed, the feature branch will be merged into master replacing the current functionality.

This PR also removes the ability to use custom labeling and custom fields. This will be added later to the feature branch.

The action was ported to work as a Docker image instead of a JavaScript image. This is because the docker image allows to build the action on demand (currently ~45 seconds). A more efficient method will be proposed later but for the current development process this satisfies the requirements.

This PR resolves #43.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants