Search code examples
amazon-web-servicespipelinegithub-actionscicd

Github Workflows CI/CD failing


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


Solution

  • 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.