I noticed when I was trying to run my github workflow to deploy my dockerized VUE app to Elastic Beanstalk that I kept getting an error in my logs saying no eslint config found, since I had just a handful of ignore lines.
So when I added a step in the workflow to ls the files being checked out, I saw it did not grab any of the files formatted as .*.
I would assume it should at least be getting the .eslintrc.* file since it is supposed to come featured to run npm install and npm run lint it would look at the checked out config file to determine if the rules pass.
Here is my workflow up to this point:
name: Deploy to Staging Environment
on: [workflow_dispatch]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Repo
uses: actions/checkout#v2
- name: List Checked Out files
run: ls
# DOES NOT SHOW ANY .* files checked out
Is anyone else noticing the same? What should I try?
Related
I wrote a script to monitoring some pages' change daily.
It scrapy the page daily, save the result to csv files, and next day compare to new scrapied data, calc the diff, then mailed to meself.
The script works well on my VPS, now I'm trying to mig it to github action.
I created a workflow, as below:
name: job run
run-name: Check page change and mail the result.
on:
push:
schedule:
- cron: '0 10 * * *'
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- uses: actions/setup-node#v3
with:
node-version: '16'
- name: Download all workflow run artifactsd
uses: actions/download-artifact#v3
- run: npm i
- run: node monitor.js
- uses: actions/upload-artifact#v3
with:
name: archive
path: |
cats_old.txt
spider_old.csv
But it doesn't download artifacts uploaded before, which means 'compare' to nothing everyday.
Run actions/download-artifact#v3
No artifact name specified, downloading all artifacts
Creating an extra directory for each artifact that is being downloaded
Unable to find any artifacts for the associated workflow
There were 0 artifacts downloaded
Artifact download has finished successfully
I guess it because every day the job triggers, github always create a new workflow, no artifacts there.
So I guess the solution should be either
"1. always trigger the save workflow, not create new one"
or
"2. some how write command to always download artifacts from last workflow"
I don't know which one is better or is there any other solution.
To 1., I can't find any command to "trigger the same".
To 2., there are more concerns, how to get the last artifact, if the last workflow errors, so on.
I also guess there be other solutions, like commit the csv to repo every day or use github api to write to gist. But if possible, I thought the solution 1 should be better.
Thank you for your help.
I have integrated chromatic into my repository and purpose is to push my storybooks into chromatic.
I have two folder in my repo: 1- backend 2- frontend and I have all storybooks in my frontend folder and my .github/workflows/chromatic.yml file looks like below:
# .github/workflows/chromatic.yml
# Workflow name
name: 'Chromatic'
# Event for the workflow
on: pull_request
# List of jobs
jobs:
chromatic-deployment:
# Operating System
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
# Job steps
steps:
- uses: actions/checkout#v1
with:
fetch-depth: 0
- name: Install dependencies
run: yarn
# 👇 Runs yarn in ./frontend
working-directory: frontend
# 👇 Adds Chromatic as a step in the workflow
- name: Publish to Chromatic
uses: chromaui/action#v1
# Chromatic GitHub Action options
with:
# 👇 Chromatic projectToken, refer to the manage page to obtain it.
workingDir: frontend
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
Is there anything wrong in chromatic.yml file? I have set event on pull request and whenever I create pull request from my branch to another branch(dev) I received notifications that "no job were run" (also attached the screenshot). And when I click "View workflow run" button I got following error:
Error: .github#L1
The job was not started because recent account payments have failed or your spending limit needs to be increased. Please check the 'Billing & plans' section in your settings.
(I have researched this error and also tried different ways as suggested but same issue I am getting).
I have a self hosted runner on github. I want to run the tests each time a PR is opened. There are 2 kinds of tests in my repo. The first kind should always run. The second kind should run only if a file in a certain path, SpecialPath, changes.
I don't know about a possibility to do so, but I imagine that the yml file would look more or less like:
name: Run tests
on: [pull_request]
jobs:
run_tests:
runs-on: self-hosted
steps:
- name: conditionally run
if: ${{ github.pull_request.files.contain("SpecialPath") }}
run: sh conditionalTests.sh
- name: run always
run: sh alwaysTests.sh
Any ideas how this might be achieved?
I currently have a Github Actions workflow setup with the following trigger:
on:
pull_request:
paths:
- 'myFolder/*.yml'
I want this workflow to run on pull request events where a file matching with myfolder/*.yml has been changed. While this workflow does run on pull request events where this file has changed, it also runs on subsequent events even if they do not make any further changes.
The workflow this trigger is for runs a process using configuration from within the yml files and so if no changes happen to any of these files between commits (even if other files that do not match the filter are changed), the result will always be the same and does not need to be run.
I looked through the documentation for Github Actions and could not find anything that exactly matches my situation so would appreciate some help and pointers.
A simplified version with some name changes of the full workflow yml is:
name: Read yml files
on:
pull_request:
paths:
- 'myFolder/*.yml'
jobs:
promote:
runs-on: ubuntu-latest
name: Read files
steps:
- uses: actions/checkout#v2
with:
fetch-depth: 0
- name: Read
run: npm run read-yml
It's not possible to do on YML workflow level.
You can however detect your case and leave early from a workflow.
I can suggest using changed-files action:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files#v17.2
- name: List all added files
run: |
for file in ${{ steps.changed-files.outputs.added_files }}; do
echo "$file was added"
done
or you can use renamed_files, deleted_files if it fits better to your needs.
Then you can detect if there are any files that may trigger your generation action - if not, simply end the workflow.
After reading this answer:this
I tried to do the same.
I have a .net core project and in my case, I am using a repo with a publish version so my appsettings.json is in the root of the repo.
# This is a basic workflow to help you get started with Actions
name: DeployToStaging
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
types: [assigned, opened, synchronize, reopened]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
FTP-Deploy-Action:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2.1.0
with:
fetch-depth: 2
- uses: microsoft/variable-substitution#v1
with:
files: '${{env.DOTNET_ROOT}}/appsettings.json'
env:
ConnectionStrings.ToBudget: 'This is just a test'
- name: FTP Deploy
uses: SamKirkland/FTP-Deploy-Action#3.1.0
with:
ftp-server: <MyServer>
# FTP account username
ftp-username: <MyUsername>
ftp-password: ${{ secrets.FtpPassword }}
So basically I want to transform my connection string (for now it is just a test, in the future I will create a secret) and then push it to the server through FTP.
Everything is working except the variable substitution. The error is: No file matched with specific pattern: /appsettings.json
Any help would be much appreciated
Just found the issue.
instead of files: '${{env.DOTNET_ROOT}}/appsettings.json' I just need to do files: 'appsettings.json'
Now I am having a second issue. SamKirkland/FTP-Deploy-Action#3.1.0 doesn't like the change. It is avoiding uploading because the repo is dirty.
EDIT: regarding the second issue I moved to sebastionpopp/ftpaction