935 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-...
114
votes
7
answers
142k
views
Push to origin from GitHub action
I'm trying to push to origin remote from GitHub action. The logic of my action is:
handle pull_request_review events and filter by comment message
checkout to master, merge PR branch, run some checks ...
149
votes
7
answers
183k
views
Using output from a previous job in a new one in a GitHub Action
For (mainly) pedagogical reasons, I'm trying to run this workflow in GitHub actions:
name: "We 🎔 Perl"
on:
issues:
types: [opened, edited, milestoned]
jobs:
seasonal_greetings:
runs-on: ...
95
votes
10
answers
83k
views
The unauthenticated git protocol on port 9418 is no longer supported
I have been using github actions for quite sometime but today my deployments started failing. Below is the error from github action logs
Command: git
Arguments: ls-remote --tags --heads git://github....
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)...
147
votes
16
answers
197k
views
How do I use an env file with GitHub Actions?
I have multiple environments (dev, qa, prod) and I'm using .env files to store secrets etc... Now I'm switching to GitHub Actions, and I want to use my .env files and declare them into the env section ...
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 ...
157
votes
5
answers
151k
views
Github Actions - trigger another action after one action is completed
I have one action (a yaml file) for deploying a docker image to Google Cloud Run.
I would like to receive Slack or Email messages informing the build and push results.
How could the message action be ...
64
votes
8
answers
41k
views
Dynamically retrieve GitHub Actions secret
I'm trying to dynamically pull back a GitHub secret using GitHub Actions at runtime:
Let's say I have two GitHub Secrets:
SECRET_ORANGES : "This is an orange secret"
SECRET_APPLES : "This is an apple ...
108
votes
4
answers
103k
views
How to share a calculated value between job steps?
Is there a DRY way to calculate and share a value in multiple job steps with GitHub Actions?
In the below workflow, echo ${GITHUB_REF} | cut -d'/' -f3-${GITHUB_SHA}` is repeated in multiple steps.
...
16
votes
5
answers
18k
views
Triggering a new workflow from another workflow?
Can I trigger a new workflow from another workflow?
I'm trying to run a workflow after the first workflow has pushed a new release and it seems to ignore it.
142
votes
5
answers
258k
views
How do I get the output of a specific step in GitHub Actions?
I have this GitHub Actions workflow which runs tests, but now I am integrating slack notification in it. I want to get the output of the Run tests step and send it as a message in the slack step.
- ...
59
votes
6
answers
46k
views
How do I make a GitHub Action matrix element conditional?
I have a workflow that uses 'strategy' = 'matrix' along with a list of specific configurations to build.
Here is my workflow file:
#
# build-N-test-v2.1-Dev and build-N-test-v2.1-Release are nearly
# ...
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 ...
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?