-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Spacecat task processor lambda #1
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1383c35
initial commit
tkotthakota-adobe 8337409
refactor
tkotthakota-adobe b266957
add npm debug
tkotthakota-adobe 50822a8
fix to ci.yaml
tkotthakota-adobe 849d474
removed unused packages
tkotthakota-adobe 7becf6c
fix index.js
tkotthakota-adobe 57f9d9a
update readme
tkotthakota-adobe d764aa7
fresh npm install
tkotthakota-adobe 2ce2706
adjust message reading logic
tkotthakota-adobe 422b083
change secrets path
tkotthakota-adobe 65513d7
resolve to right secrets name
tkotthakota-adobe 078895a
fix api calls
tkotthakota-adobe f1fca92
fix slack message
tkotthakota-adobe 67d3ba6
refactor + add opportunity status task processor
tkotthakota-adobe 60d0f9b
use right api for to get suggestions
tkotthakota-adobe 1471437
tweaks
tkotthakota-adobe c640c0a
adjust slack messages
tkotthakota-adobe 58c6899
incorporate review comments
tkotthakota-adobe 087da0c
tweak message
tkotthakota-adobe cc9d2ee
combine messages
tkotthakota-adobe 67a1422
add each opportunity in a new line
tkotthakota-adobe db143d5
test files todo
tkotthakota-adobe 1c16de6
add tests
tkotthakota-adobe 5793d93
increase the coverage limits
tkotthakota-adobe 5e3eb12
review comments
tkotthakota-adobe 6d84d84
Revert "review comments"
tkotthakota-adobe be82400
address review comments
tkotthakota-adobe cb1e02b
point to task manager secrets managher
tkotthakota-adobe 51b73bc
pass slack tokens from api service
tkotthakota-adobe ad782cc
Revert "pass slack tokens from api service"
tkotthakota-adobe 2554042
fix name missing issue
tkotthakota-adobe 28a5501
experience url fix
tkotthakota-adobe 3c68ee3
fix test
tkotthakota-adobe 8539d7b
use imsOrgId for mapping
tkotthakota-adobe 6dd366a
review comments addressed
tkotthakota-adobe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| .vscode/* | ||
| coverage/* | ||
| scripts/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Copyright 2021 Adobe. All rights reserved. | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
| * of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under | ||
| * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
| * OF ANY KIND, either express or implied. See the License for the specific language | ||
| * governing permissions and limitations under the License. | ||
| */ | ||
|
|
||
| module.exports = { | ||
| root: true, | ||
| parser: '@typescript-eslint/parser', | ||
| parserOptions: { | ||
| ecmaVersion: 2020, | ||
| sourceType: 'module', | ||
| }, | ||
| extends: [ | ||
| '@adobe/helix', | ||
| 'plugin:@typescript-eslint/recommended', | ||
| ], | ||
| plugins: [ | ||
| 'import', | ||
| '@typescript-eslint', | ||
| ], | ||
| overrides: [ | ||
| { | ||
| files: ['*.test.js'], | ||
| rules: { | ||
| '@typescript-eslint/no-unused-expressions': 'off', | ||
| }, | ||
| }, | ||
| ], | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| name: Bug report | ||
| about: Create a report to help us improve | ||
| labels: bug | ||
|
|
||
| --- | ||
|
|
||
| **Description** | ||
| A clear and concise description of what the bug is. | ||
|
|
||
| **To Reproduce** | ||
| Steps to reproduce the behavior: | ||
| 1. Go to '...' | ||
| 2. Click on '....' | ||
| 3. Scroll down to '....' | ||
| 4. See error | ||
|
|
||
| **Expected behavior** | ||
| A clear and concise description of what you expected to happen. | ||
|
|
||
| **Screenshots** | ||
| If applicable, add screenshots to help explain your problem. | ||
|
|
||
| **Version:** | ||
| run: `$ hlx --version` | ||
|
|
||
| **Additional context** | ||
| Add any other context about the problem here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| name: Discussion | ||
| about: Start a new discussion | ||
| labels: question | ||
|
|
||
| --- | ||
|
|
||
| ## Overview | ||
| whats' this discussion about? | ||
|
|
||
| ## Details | ||
| more details | ||
|
|
||
| ## Proposed Actions | ||
| and now? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| name: Feature request | ||
| about: Suggest an idea for this project | ||
| labels: enhancement | ||
|
|
||
| --- | ||
|
|
||
| **Is your feature request related to a problem? Please describe.** | ||
| A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
|
||
| **Describe the solution you'd like** | ||
| A clear and concise description of what you want to happen. | ||
|
|
||
| **Describe alternatives you've considered** | ||
| A clear and concise description of any alternative solutions or features you've considered. | ||
|
|
||
| **Additional context** | ||
| Add any other context or screenshots about the feature request here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: "Set up AWS Credentials and Fetch Secrets" | ||
| description: "Configures AWS credentials for use in subsequent steps. Fetches secrets from AWS Secrets Manager." | ||
|
|
||
| inputs: | ||
| aws_role_to_assume: | ||
| description: "ARN of the IAM role to assume" | ||
| default: "arn:aws:iam::682033462621:role/spacecat-role-github-actions" | ||
| required: true | ||
| secret_ids: | ||
| description: "List of secret IDs to fetch from AWS Secrets Manager" | ||
| default: | | ||
| /spacecat/github-actions | ||
| required: true | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Configure AWS Credentials | ||
| id: creds | ||
| uses: aws-actions/configure-aws-credentials@v4 | ||
| with: | ||
| aws-region: us-east-1 | ||
| role-to-assume: ${{ inputs.aws_role_to_assume }} | ||
|
|
||
| - name: Fetch AWS Secrets | ||
| uses: aws-actions/aws-secretsmanager-get-secrets@v2 | ||
| with: | ||
| parse-json-secrets: true | ||
| secret-ids: ${{ inputs.secret_ids }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: "Lint, Test, and Coverage" | ||
| description: "Runs lint and test commands, plus coverage" | ||
|
|
||
| inputs: | ||
| codecov_token: | ||
| description: "Codecov Token (optional)" | ||
| required: false | ||
| default: "" | ||
| upload_coverage: | ||
| description: "Whether to upload coverage to Codecov (true/false). Default false." | ||
| required: false | ||
| default: "false" | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Lint | ||
| run: npm run lint | ||
| shell: bash | ||
|
|
||
| - name: Test | ||
| run: npm run test | ||
| shell: bash | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| if: ${{ inputs.upload_coverage == 'true' }} | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ inputs.codecov_token }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| name: "Setup Node & NPM (with cache)" | ||
| description: "Checks out code, sets up Node, uses NPM cache, installs dependencies" | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Set up Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22.12 | ||
|
|
||
| - name: Get npm cache directory | ||
| id: npm-cache-dir | ||
| run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT | ||
| shell: bash | ||
|
|
||
| - name: Set up NPM Cache | ||
| uses: actions/cache@v4 | ||
| id: npm-cache | ||
| with: | ||
| path: ${{ steps.npm-cache-dir.outputs.dir }} | ||
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node- | ||
|
|
||
| - name: Update NPM (only if cache miss) | ||
| run: npm install -g [email protected] | ||
| shell: bash | ||
|
|
||
| - name: Install dependencies (only if cache miss) | ||
| run: npm ci | ||
| shell: bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Please ensure your pull request adheres to the following guidelines: | ||
| - [ ] make sure to link the related issues in this description | ||
| - [ ] when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes | ||
|
|
||
| ## Related Issues | ||
|
|
||
|
|
||
| Thanks for contributing! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| name: Build | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
| issues: read | ||
|
|
||
| on: [push] | ||
|
|
||
| env: | ||
| CI_BUILD_NUM: ${{ github.run_id }} | ||
| CI_BRANCH: ${{ github.ref_name }} | ||
| HLX_AWS_REGION: ${{ secrets.AWS_REGION }} | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: 'false' | ||
| - name: Setup Node & NPM | ||
| uses: ./.github/actions/setup-node-npm | ||
|
|
||
| - name: Lint, Test, Coverage Upload | ||
| uses: ./.github/actions/lint-test-coverage | ||
| with: | ||
| upload_coverage: "true" | ||
| codecov_token: ${{ secrets.CODECOV_TOKEN }} | ||
|
|
||
| - name: Semantic Release (Dry Run) | ||
| if: github.ref != 'refs/heads/main' | ||
| run: npm run semantic-release-dry | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} | ||
|
|
||
| semantic-release: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| if: github.ref == 'refs/heads/main' | ||
| steps: | ||
| - name: Check out | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: 'false' | ||
|
|
||
| - name: Configure Environment | ||
| run: echo -e "LOG_LEVEL=info\n" > .env | ||
|
|
||
| - name: Setup Node & NPM | ||
| uses: ./.github/actions/setup-node-npm | ||
|
|
||
| - name: Configure AWS | ||
| uses: ./.github/actions/configure-aws | ||
| with: | ||
| aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_PROD}}:role/spacecat-role-github-actions' | ||
|
|
||
| - name: Semantic Release | ||
| run: npm run semantic-release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.ADOBE_BOT_GITHUB_TOKEN }} | ||
| NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} | ||
| AWS_REGION: us-east-1 | ||
| AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_PROD}} | ||
|
|
||
| deploy-stage: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| if: github.ref == 'refs/heads/main' | ||
| steps: | ||
| - name: Check out | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: 'false' | ||
|
|
||
| - name: Setup Node & NPM | ||
| uses: ./.github/actions/setup-node-npm | ||
|
|
||
| - name: Configure AWS for STAGE | ||
| uses: ./.github/actions/configure-aws | ||
| with: | ||
| aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_STAGE}}:role/spacecat-role-github-actions' | ||
|
|
||
| - name: Branch Deployment | ||
| run: npm run deploy-stage | ||
| env: | ||
| AWS_REGION: us-east-1 | ||
| AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_STAGE}} | ||
|
|
||
|
|
||
| branch-deploy: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| if: github.ref != 'refs/heads/main' | ||
| steps: | ||
| - name: Check out | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: 'false' | ||
|
|
||
| - name: Setup Node & NPM | ||
| uses: ./.github/actions/setup-node-npm | ||
|
|
||
| - name: Configure AWS | ||
| uses: ./.github/actions/configure-aws | ||
| with: | ||
| aws_role_to_assume: 'arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_DEV}}:role/spacecat-role-github-actions' | ||
|
|
||
| - name: Branch Deployment | ||
| run: npm run deploy-dev | ||
| env: | ||
| AWS_REGION: us-east-1 | ||
| AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID_DEV}} | ||
|
|
||
| - name: Post-Deployment Integration Test | ||
| run: npm run test-postdeploy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| on: | ||
| push: | ||
| branches-ignore: | ||
| - 'main' | ||
|
|
||
| jobs: | ||
| ci_trigger: | ||
| runs-on: ubuntu-latest | ||
| name: Comment Semantic Release Status | ||
| steps: | ||
| - name: Comment | ||
| id: comment | ||
| uses: adobe-rnd/github-semantic-release-comment-action@master | ||
| with: | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| coverage | ||
| .nyc_output/ | ||
| node_modules/ | ||
| junit | ||
| dist | ||
| tmp | ||
| logs | ||
| .DS_Store | ||
| test-results.xml | ||
| .env | ||
| .idea/ | ||
| .vscode/ | ||
| .aws-sam/ | ||
| env.sh | ||
| output.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| npx lint-staged | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "plugins": [], | ||
| "recurseDepth": 10, | ||
| "source": { | ||
| "includePattern": ".+\\.js(doc|x)?$", | ||
| "excludePattern": "(^|\\/|\\\\)_" | ||
| }, | ||
| "sourceType": "module", | ||
| "tags": { | ||
| "allowUnknownTags": true, | ||
| "dictionaries": ["jsdoc","closure"] | ||
| }, | ||
| "templates": { | ||
| "cleverLinks": false, | ||
| "monospaceLinks": false | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "reporterEnabled": "spec,xunit", | ||
| "xunitReporterOptions": { | ||
| "output": "junit/test-results.xml" | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.