Can't make my Github workflow runner to pick a very simple job - github

I got this very basic workflow set up in my project's .github/workflows/main.yml file. As you see is really basic, it's the simplest option I could find as an example (I tried other options, none of them work).
name: main
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
Run-npm-on-Ubuntu:
name: Run npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- uses: actions/setup-node#v3
with:
node-version: '14'
- run: npm help`
I keep getting the following: Waiting for a runner to pick up this job...
Is there a way to debug it at least? Even if I cancel the workflow, the log file not giving me any information.
Possibly something wrong with my configuration, but not sure what.
Expecting the runner to pick up my workflow.

Related

Working directory is not working in my Github action

I'm starting to use Github actions. When I ran the process in my Ubuntu server, one of the config options was to select the work folder, by default, I leave _work. But previously, I had my repository in another folder.
So, I'm trying to add a specific value for working-directory to my yml, file but is not using the value in the build process.
YML File:
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
defaults:
run:
working-directory: /../../../../var/www/mysite.com
jobs:
deployment:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout#v3
- name: Use Node.js
uses: actions/setup-node#v3
with:
node-version: '14.x'
- name: Install dependencies
run: yarn
- name: Build
run: yarn build
- name: Restart server application
run: pm2 restart pm2_script.json
The process ran ok, but is doing all the process (checkout, build, etc) inside _work and not inside working-directory
What I'm doing wrong?
Thanks!!

Github action for pull request not running

Github actions on pull request were working yesterday. Today they are not running.
.github/workflows/pull_request.yml looks like
name: Pull Request
on:
pull_request:
paths-ignore:
- '.github/**'
jobs:
black_and_flake8:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout#v3
- name: "Lint project"
uses: ./.github/actions/lint_project
test_common:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout#v3
- name: "Test common"
uses: ./.github/actions/test_common
test_dags:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout#v3
- name: "Test dags"
uses: ./.github/actions/test_dags
[etc there are a lot of jobs for different parts of this repo]
For example, ./github/actions/test_dags has a single action.yml file inside that looks like this
name: "test_dags"
description: "Tests for code that lives in /dags"
runs:
using: "composite"
steps:
- name: Run pytest
working-directory: dags
run: |
docker build -t dagtest -f Dockerfile.airflow_dags_test .
docker run --name=dagtestimage dagtest
docker cp dagtestimage:/tmp/htmlcov .
shell: bash
- uses: actions/upload-artifact#v3
with:
name: dags_htmlcov
path: /home/runner/work/processing/processing/dags/htmlcov/
Putting aside that there may be a smarter way to run these tests, why are no actions being fired at all when I make a pull request now? It happily ran all my checks yesterday. Nothing has merged into main related to github actions- just some pytest stuff for one of the modules, and that ran the checks.
My PR is changing the dockerfile referenced in the action above, updating requirements.txt, and to debug I changed a python file (in case those file types were magically excluded).
The GUI for the PR doesn't show any checks. Nothing new shows up in the Actions tab.
How do I figure out why this isn't working?
Turns out github is having an issue - https://www.githubstatus.com/ said everything was green when I posted this, but it has since updated to
Incident with GitHub Actions, API Requests, Codespaces, Git Operations, GitHub Packages, and GitHub Pages

Updated Node version in GitHub Action not being picked up in PR checks

I have the following action set up in my private GitHub repo:
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.17.x]
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install --frozen-lockfile
- run: yarn test
Previously, the node-version was set to [15.x] and everything worked wonderfully. Since updating the required Node version to 14.17.x I have a check in my PRs that never resolves. It says:
build (15.x) Expected — Waiting for status to be reported Required
What am I missing here? It’s almost as if something is cached.
The issue ended up being a required status check that was added in “Settings » Branches » Require status checks to pass before merging » Require branches to be up to date before merging”. I removed that status check and re-added the updated version, then the message disappeared from the Checks list in all open PRs.

error "gatsby-source-github-api" threw an error while running the sourceNodes lifecycle: token is undefined

I am new to Gatsby and just tried a GH Actions workflow for my site today. I see this error at the build stage:
error "gatsby-source-github-api" threw an error while running the
sourceNodes lifecycle: token is undefined
I am using this to pull all repos on my Github into the site.
What I have tried so far:
Checked the Github personal access token
the build is working locally
Versions:
"gatsby-source-github-api": "^0.2.1" "gatsby": "^2.26.1"
This is my node.js.yml GH Actions workflow file:
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [13.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
PS: I have used a .env file to hold the value of the token that the plugin 'gatsby-source-github-api' requires. And it is in my .gitignore file. So which means it is not sent to GH and hence can't find it?
So that was it -- the .env file which wasn't being pushed to Github.
So I needed to make the token available to the GH Action build somehow.
I tried the action SpicyPizza/create-envfile#v1. It isn't supported by Github but seemed to do the job. It creates a .env file at build with the keys you provide it.
You could also create a .env file manually. See thread.

Is it possible to not run github action for readme updates?

I have the following action on Github actions that automatically packs and deploy a package to nuget.org every time a PR gets merged into master.
name: Nuget Deploy
on:
push:
branches: [ master ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout#v2
- name: Setup .NET Core
uses: actions/setup-dotnet#v1
with:
dotnet-version: 3.1.101
- name: Generate Nuget package
run: dotnet pack
working-directory: DateOverride
- name: Deploy to nuget.org
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_DEPLOY_KEY }} -s https://api.nuget.org/v3/index.json
working-directory: DateOverride/DateOverride/bin/Debug
But I would like that it was not run if my update is only a README.md update, is it possible to do so?
I'd think the paths-ignore setting should help:
on:
push:
branches:
- master
paths-ignore:
- '**/README.md'
You might want to combine your current GitHiub Action with another like MarceloPrado/has-changed-path
This action outputs whether a path or combination of paths has changed in the previous commit.
[This] action is meant to be used inside your job steps, not at the root of your workflow file
Or (opposite filter): dorny/paths-filter
With this Github Action you can execute your workflow steps only if relevant files are modified.