Skip to content

fix for multiple actions using the require-adobe-auth annotation in the same package#137

Merged
moritzraho merged 1 commit intoadobe:masterfrom
moritzraho:fix-adobe-annotation
Mar 17, 2020
Merged

fix for multiple actions using the require-adobe-auth annotation in the same package#137
moritzraho merged 1 commit intoadobe:masterfrom
moritzraho:fix-adobe-annotation

Conversation

@moritzraho
Copy link
Copy Markdown
Member

Description

The current implementation of require-adobe-auth is not working when multiple actions in the same action use the annotation.
This is a fix for it using lodash.clonedeep.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@moritzraho moritzraho changed the title fix for multiple secured actions in same package fix for multiple actions using the require-adobe-auth annotation in the same package Mar 17, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 17, 2020

Codecov Report

Merging #137 into master will not change coverage by %.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #137   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           57        57           
  Lines         1809      1809           
  Branches       325       326    +1     
=========================================
  Hits          1809      1809           
Impacted Files Coverage Δ
src/runtime-helpers.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c73737f...207ccd8. Read the comment docs.

Comment thread src/runtime-helpers.js
// avoid side effects, do not modify input packages
const newPackages = { ...packages }
const newDeploymentPackages = { ...deploymentPackages }
const newPackages = cloneDeep(packages)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

going with clone deep adds a (small) dependency but makes the implementation clearer and less error prone

Comment thread src/runtime-helpers.js

// copy actions to the new package and move the action content to the new key
newPackages[key]['actions'] = {
...packages[key]['actions'],
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here was the problem as we were overriding any previous action rewrites

@moritzraho moritzraho requested review from purplecabbage and removed request for purplecabbage March 17, 2020 08:57
@moritzraho moritzraho merged commit 539a1de into adobe:master Mar 17, 2020
@moritzraho moritzraho deleted the fix-adobe-annotation branch March 17, 2020 09:14
bhageena pushed a commit to bhageena/aio-cli-plugin-runtime that referenced this pull request Jul 21, 2021
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.

2 participants