Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github actions dynamic workflow name

I have a manually triggered job that builds and deploys an image based on the tag I specify. Is there a way to make the workflow name dynamic?

name: Build and push

on:
  workflow_dispatch:
    inputs:
      tag:
        description: 'Image Tag'
        required: true

jobs:
...

I would like to do something like

name: "Build and push ${{ github.event.inputs.tag }}"
like image 892
Michael Roudnintski Avatar asked Jan 08 '21 18:01

Michael Roudnintski


People also ask

What should I name my GitHub workflow file?

Each workflow will run depending on the trigger event you've configured. Your GitHub Actions workflow file can be named anything you like, although, I wouldn't recommend naming it action. yml .

What is workflow call in GitHub Actions?

You call a reusable workflow by using the uses keyword. Unlike when you are using actions within a workflow, you call reusable workflows directly within a job, and not from within job steps. jobs.<job_id>.uses. You reference reusable workflow files using one of the following syntaxes: {owner}/{repo}/.

What is GitHub Head_ref?

github.head_ref. string. The head_ref or source branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is either pull_request or pull_request_target .

What are the two types of GitHub Actions?

Types of actions. You can build Docker container and JavaScript actions.


1 Answers

Workflow names are not dynamic, but fixed.

To get at the actual data of a workflow run, you'll have to chose the specific run from the Actions > All Workflows > [name-of-your-workflow] list.

Alternatively, you can think about other ways to propagate the outcomes of your builds.

  • Our team, for example, propagates build outcomes to teams chat channel (in our case Microsoft Teams using the action notify-microsoft-teams). If you search the market place you'll find plenty of actions for this.
  • Another alternative could be to generated custom badges, which you could then make visible to your team. A nice action for this is bring-your-own-badge.
  • Last but not least you can propagate your workflow run data using emails (again, there are actions which do this for you).
like image 109
fgysin Avatar answered Oct 10 '22 05:10

fgysin