11,246 questions
427
votes
35
answers
473k
views
How to get the current branch within GitHub Actions?
I'm building Docker images with GitHub Actions and want to tag images with the branch name.
I found the GITHUB_REF variable, but it results in refs/heads/feature-branch-1 and I need only feature-...
411
votes
9
answers
321k
views
How to run a github-actions step, even if the previous step fails, while still failing the job
I'm trying to follow an example Github has for testing my build with github actions, and then compressing the test results and uploading them as an artifact.
https://help.github.com/en/actions/...
399
votes
4
answers
402k
views
Running actions in another directory
I've just started exploring Github actions however I've found myself placing a command in multiple places.
I have a PHP project where the composer.json is not in the root, my structure looks like:
...
335
votes
13
answers
308k
views
How can I run GitHub Actions workflows locally?
I am planning to move our Travis CI build to GitHub Actions using Docker for our per-commit testing.
Can I reproducibly run these new GitHub Actions workflows locally? Is there a generic way to run ...
334
votes
3
answers
150k
views
How to apt-get install in a GitHub Actions workflow?
In the new GitHub Actions, I am trying to install a package in order to use it in one of the next steps.
name: CI
on: [push, pull_request]
jobs:
translations:
runs-on: ubuntu-latest
steps:
...
304
votes
4
answers
327k
views
How do I set an env var with a bash expression in GitHub Actions?
In GitHub Actions, I'd like to evaluate a bash expression and then assign it to an environment variable:
- name: Tag image
env:
GITHUB_SHA_SHORT: ${{ $(echo $GITHUB_SHA | cut -c 1-6)...
294
votes
12
answers
296k
views
Only run job on specific branch with GitHub Actions
I'm relatively new to GitHub Actions and I have 2 jobs–one that runs my tests, and one that deploys my project onto a server.
Obviously I want the tests to run on every branch, but deploying should ...
260
votes
5
answers
137k
views
Dependencies Between Workflows on Github Actions
I have a monorepo with two workflows:
.github/workflows/test.yml
name: test
on: [push, pull_request]
jobs:
test-packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
...
247
votes
7
answers
153k
views
GitHub Actions: Split Long Command into Multiple Lines
I have a Github action command that is really long:
name: build
on: [push]
jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: ...
242
votes
6
answers
148k
views
Github actions share workspace/artifacts between jobs?
Trying to use Github's beta actions, I have two jobs, one that builds the code and then one that will deploy code. However, I can't seem to get the build artifact in deploy job.
My latest attempt is ...
240
votes
23
answers
127k
views
How to resolve "refusing to allow an OAuth App to create or update workflow" on git push
Getting
refusing to allow an OAuth App to create or update workflow .github/workflows/cd.yml without workflow scope"
on git push. How to grant workflow scope?
211
votes
7
answers
181k
views
GitHub Actions: how can I run a workflow created on a non-'master' branch from the 'workflow_dispatch' event?
For actions working on a third party repository, I would like to be able to create an action on a branch and execute it on the workflow_dispatch event. I have not succeeded in doing this, but I have ...
200
votes
38
answers
109k
views
Delete a workflow from GitHub Actions
I created a couple workflows in the .github/workflows folder of my repository to experiment with GitHub Actions. I have since learned quite a bit and deleted said experimental workflows from my repo. ...
195
votes
5
answers
186k
views
How to run GitHub Actions workflow only if the pushed files are in a specific folder
I have a folder structure that looks something like this.
- folder1
- file1
- *other files*
- folder2
- file1
- *other files*
- .gitignore
- package.json
- *other files*
I want to run my ...
184
votes
1
answer
111k
views
Set default Timeout on Github action pipeline
Normally, my pipelines take 15 minutes to execute.
Recently, for some strange reasons, some pipelines take between 45 minutes and 6 hours to fail.
Is it possible to set a default timeout limit on ...