3

My CI/CD pipeline that is using github workflows is failing giving the following error:

Error: Unable to process command '##[add-path]/opt/hostedtoolcache/aws/0.0.0/x64' successfully. Error: The add-path command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the ACTIONS_ALLOW_UNSECURE_COMMANDS environment variable to true. For more information see: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

This is my container.yml file

name: deploy-container

on:
  push:
    branches:
      - master
      - develop
    paths:
      - "packages/container/**"

defaults:
  run:
    working-directory: packages/container

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - run: npm install
      - run: npm run build

      - uses: chrislennon/action-aws-cli@v1.1
      - run: aws s3 sync dist s3://${{ secrets.AWS_S3_BUCKET_NAME }}/container/latest
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Any idea why this might be happening. Thanks in advance

Vimal Kurien Sam
  • 246
  • 4
  • 10
  • Did you try using another action than `chrislennon/action-aws-cli` to setup aws cli, as this one has been archived by his author (and may be obsolete)? [You can find all of them on the Github Marketplace](https://github.com/marketplace?category=&query=AWS+CLI+sort%3Apopularity-desc&type=actions&verification=). – GuiFalourd Sep 21 '21 at 13:44

2 Answers2

7

I know the Tutorial which this is from, use

  - name: ACTIONS_ALLOW_UNSECURE_COMMANDS
    run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV

before

  - uses: chrislennon/action-aws-cli@v1.1

and it should work.

Lord Gulasch
  • 106
  • 2
1

jobs: build: runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v2
  - run: npm install
  - run: npm run build
  
  - uses: aws-actions/configure-aws-credentials@v1
    with:
      aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
      aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      aws-region: us-east-1
  - run: aws s3 sync dist s3://${{ secrets.AWS_S3_BUCKET_NAME }}/container/latest