I am running the following in github actions but I get an error.
name: Push app extension code
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: Build
runs-on: macos-latest
steps:
- uses: actions/checkout#v1
- uses: shopify/shopify-cli-action#v1
with:
path: 'extensions/my_extension'
auth-token: '${{ secrets.SHOPIFY_CLI_AUTH_TOKEN }}'
command: 'push --extension-id=${{ secrets.SHOPIFY_EXTENSION_ID }} --api-key=${{ secrets.SHOPIFY_API_KEY }} --api-secret=${{ secrets.SHOPIFY_API_SECRET }} --force'
error
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
Error: Command failed: gem install shopify-cli
Is there a solution?
Related
I am making a Github workflow for testing a lambda function correctness.
Here is a snippet of the workflow config:
name: push-lambda
on:
push:
branches:
- main
env:
PYTHON_VERSION: "3.9"
defaults:
run:
shell: bash
jobs:
test_lambda:
runs-on: ubuntu-latest
steps:
- name: Install python
- uses: actions/setup-python#v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install bs4
run: pip install bs4
- name: Checkout repo
- uses: actions/checkout#v3
- name: Test function correctness
run: python function.py
(...)
However, I keep getting a
You have an error in your yaml syntax on line 20
error message. Line 20 is the first steps: keyword. Can anyone spot where I am making a mistake?
There is an indentation problem in your YAML at line 20, in the Install python step.
You're using:
jobs:
test_lambda:
runs-on: ubuntu-latest
steps:
- name: Install python
- uses: actions/setup-python#v4
with:
python-version: ${{ env.PYTHON_VERSION }}
Instead of:
jobs:
test_lambda:
runs-on: ubuntu-latest
steps:
- name: Install python
- uses: actions/setup-python#v4
with:
python-version: ${{ env.PYTHON_VERSION }}
The with field should be at the same level than the uses field.
The chart is packaged but fails at releasing the charts.
Error: error creating GitHub release kafka-cluster-0.1.0: failed to upload release asset: /home/sid/actions-runner/_work/<repo>/<repo>/.cr-release-packages/kafka-cluster-0.1.0.tgz
: POST https://ghe.com/api/uploads/repos/<org>/<repo>/releases/78254/assets?name=kafka-cluster-0.1.0.tgz: 502 Error uploading to https://media.<org ghe>.com/releases/78254/files: 404 []
The helm chart action I'm using
name: Release Chart
on:
push:
branches:
- main
jobs:
release:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout#v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR#users.noreply.github.com"
- name: Run chart-releaser
uses: <org>/helm-releaser-action#v1.4.0
with:
config: cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
My github token has these permissions
my cr.yaml :
owner: <org>
git-repo: <repo>
token: ${{ secrets.GITHUB_TOKEN }}
git-base-url: https://ghe/api/v3/
git-upload-url: https://ghe/api/uploads/
I'm trying to make GitHub CI
What's wrong with this formatting?
I have such a problem
Invalid workflow file
You have an error in your yaml syntax on line 8
screenshot of error
name: Chart project CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
check-links:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [17.x]
steps:
uses: actions/checkout#v3
- name: Starting Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v3
with:
node-version: ${{ matrix.node-version }}
- name: install modules
- run: npm install
- name: build project
- run: npm build
- name: unit test
- run: npm test
Additional info
There are some indentation and syntax issue. Please find the correct code below. Here you can find a sample run. Link
name: Test CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
check-links:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [17.x]
steps:
- uses: actions/checkout#v3
- name: Starting Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v3
with:
node-version: ${{ matrix.node-version }}
- name: install modules
run: npm install
- name: build project
run: npm build
- name: unit test
run: npm test
I'm attempting to create a GHA workflow and I am getting an error that I'm unsure how to fix as I've implemented this in similar environments before.
name: Deploy Staging
# Controls when the workflow will run
on:
# Triggers the workflow on push events only for the main branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
# Run the build job first
build:
name: Build
uses: ./.github/workflows/build.yml
deploy-staging:
name: Staging Deploy
runs-on: ubuntu-latest
environment:
name: staging
needs: [build]
permissions:
id-token: write
contents: read
steps:
- uses: actions/setup-node#v3
with:
node-version: '14'
- name: Download build artifacts
uses: actions/download-artifact#v3
with:
name: buildResult
- name: CDK install
run: npm install -g aws-cdk
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials#v1
with:
role-to-assume: XXXX
aws-region: us-east-1
- name: CDK diff
run: cdk --app . diff staging
- name: CDK deploy
run: cdk --app . deploy staging --require-approval never
- name: Configure DX AWS credentials
uses: aws-actions/configure-aws-credentials#v1
with:
role-to-assume: XXXX
aws-region: us-east-1
role-session-name: "${{ github.actor }}"
- name: Report deployment
uses: XXXX/deployment-tracker-action#v1
if: always()
with:
application-name: XXXX
environment: staging
platform: test
deployment-status: ${{ steps.deploy-workload.outcome == 'success' && 'success' || 'fail' }}
aws-region: us-east-1
XXXX
I don't understand quite where I'm going wrong here but when I merged my actions branch and I attempted to get it to work, I received the following message:
error parsing called workflow "./.github/workflows/build.yml": workflow is not reusable as it is missing a `on.workflow_call` trigger
Below is my build file for reference.
name: Build
# Controls when the workflow will run
on:
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
buildEnvironment:
description: Build Environment
required: false
default: production
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# next build runs lint, don't need a step for it
build:
name: Build
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout#v3
- uses: actions/setup-node#v3
with:
node-version: '14'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials#v1
with:
role-to-assume: XXXX
aws-region: us-east-1
role-session-name: "${{ github.actor }}"
- name: Install Dependencies
run: npm install
- name: CDK install
run: npm install -g aws-cdk
- name: CDK build
run: cdk synth
- name: Upload build artifacts
uses: actions/upload-artifact#v3
with:
name: buildResult
path: |
cdk.out
test:
name: Test
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout#v3
- uses: actions/setup-node#v3
with:
node-version: '14'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials#v1
with:
role-to-assume: XXXX
aws-region: us-east-1
role-session-name: "${{ github.actor }}"
- name: Install Dependencies
run: npm install
- name: Run tests
run: npm test
If you want to call another workflow (reusable workflow), the workflow you're calling needs to have the trigger workflow_call.
Therefore, in order to resolve your error, change build.yml to:
name: Build
on:
workflow_call:
pull_request:
# etc..
I'm trying to copy a jar via SCP in a GitHub Action which I build with maven in the step before.
My problem is, that the SCP step never finds the jar file and fails. Any idea how I can fix/realize this, so the step finds the file?
This is the error I get:
Error: localFile does not exist at /home/runner/work/rest-api/rest-api/target/RestApi.jar
This is what my workflow looks like:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Build
run: |
mvn clean package
- name: Deployment
uses: garygrossgarten/github-action-scp#release
with:
local: "/home/runner/work/rest-api/rest-api/target/RestApi.jar"
remote: "/opt/rest-api/"
host: ${{ secrets.HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.PASSWORD }}
Thanks in Advance
Ael