Coder Social home page Coder Social logo

franzdiebold / github-env-vars-action Goto Github PK

View Code? Open in Web Editor NEW
178.0 178.0 23.0 1.48 MB

:octocat: ๐Ÿš€ GitHub Action for Environment Variables

Home Page: https://github.com/marketplace/actions/github-environment-variables-action

License: MIT License

JavaScript 87.66% Makefile 4.12% Dockerfile 8.22%
cicd deployment environment-variables github-action github-actions slug workflow

github-env-vars-action's Introduction

Hi!

github-env-vars-action's People

Contributors

franzdiebold avatar iamstarkov avatar jonathanlinat avatar priyankasaggu11929 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

github-env-vars-action's Issues

All of sudden this action is failing for me

All of sudden this action is failing for me. it was working fine till yesterday.

Current runner version: '2.275.1' Runner name: 'gha-runner-signup-team-qat[2](https://github.com/***/user-profile/actions/runs/4831889357/jobs/8609933726#step:1:2)-69dd78bdc4-f6v8c' Runner group name: 'growth' Machine name: 'gha-runner-signup-team-qat2-69dd78bdc4-f6v8c' Prepare workflow directory Prepare all required actions Getting action download info Download action repository 'FranzDiebold/github-env-vars-action@v2' Download action repository 'actions/checkout@v[3](https://github.com/***/user-profiletions/runs/4831889357/jobs/8609933726#step:1:3).[5](https://github.com/***/user-profile/actions/runs/4831889357/jobs/8609933726#step:1:5).2' Download action repository 'actions/setup-node@v3.[6](https://github.com/***/user-profile/actions/runs/4831889357/jobs/8609933726#step:1:6).0' Error: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter ''using: node16' is not supported, use 'docker' or 'node12' instead.') at GitHub.Runner.Worker.ActionManifestManager.ConvertRuns(IExecutionContext executionContext, TemplateContext templateContext, TemplateToken inputsToken, String fileRelativePath, MappingToken outputs) at GitHub.Runner.Worker.ActionManifestManager.Load(IExecutionContext executionContext, String manifestFile) Error: Fail to load FranzDiebold/github-env-vars-action/v2/action.yml

Commit messages

Hi - great addin, makes a lot of writing GitHub actions easier.

BUT ... I can't find anywhere to obtain the text of a commit message.

If a PR is squashed, the CI_PR_DESCRIPTION will have all the commits, but I was hoping to emulate the GitHub slack app. It shows a commit message:

1 new commit pushed to master by whosyourdaddy
48f8e748 - Item Maintenance V2 sort Feature (#186)
Pull request merged by bossbaby

#186 Item Maintenance V2 sort Feature

  • message from commit
  • another message from commit
    #197 linkToPR | Aug 13th

Although now that I really look at it, some of the text comes from a PR, not the commit, so maybe even GitHub can't get the commit message? Yet the text after the code is only from the commit message.

Is it possible to get the commit message on a push action?

Add common variable branch names and tags

Hello,

in GitLab CI/CD there is a CI_COMMIT_REF_NAME predefined variable that either stores a tag when it's pushed or a branch name, even when a commit is pushed under opened Merge Request. There is also a CI_MERGE_REQUEST_IID that stores the Merge Request reference number.

CI_COMMIT_REF_NAME ... The branch or tag name for which project is built
CI_MERGE_REQUEST_IID ... The project-level IID (internal ID) of the merge request. Only available If the pipelines are for merge requests and the merge request is created. This ID is unique for the current project.

Docs

On the other hand in GitHub Actions ref for commits pushed under opened Pull Requests points to the pull request instead of branch.

I can see that #19 was solved by introducing GITHUB_BRANCH_NAME. Unfortunately this does not solve the issue when one would like to have a job with a single variable that is populated with either branch name or a tag. This is really useful since both branch names and tags are far more informative than merge request numbers (e.g. docker image tags).

This project's readme states that:

GITHUB_REF_NAME | The branch or tag name that triggered the workflow. If neither a branch or tag is available for the event type, the variable will not exist.

Reading this description at first I thought that it works just like mentioned CI_COMMIT_REF_NAME from GitLab CI/CD.

I can understand that in GitHub's world for opened Pull Requests the ref points to an actual PR reference instead of the branch that it is based on. If it would be confusing, problematic, or just not desired to have GITHUB_REF_NAME and its derivatives work like CI_COMMIT_REF_NAME in GitLab, could you please consider adding another variable (e.g. COMMIT_REF_NAME) that works in such way?

Best regards.

for pull_request GITHUB_REF_NAME doesn't contains actual branch name

If job is triggered using pull_request there is no actual branch available in GITHUB_REF_NAME. This looks a bit issue in GitHub context side since there is no clear variable where to get branch name regardless how job is triggered. Maybe branch name extracting should be separate variable that works also for pull_requests.

gitHub.ref: "refs/pull/844/merg
head_ref: "my-branch",
GITHUB_REF_SLUG: refs-pull-844-merge
GITHUB_REF_NAME: 844/merge
GITHUB_REF_NAME_SLUG: 844-merge

Only works on linux

If this can't be fixed easily so it runs on windows (and mac), I think the readme should be updated to mention its compatibility.

image

Step:

- uses: FranzDiebold/[email protected]

*_SLUG envs are not truncated

*_SLUG environment variables are commonly used as URLs or docker image tags. To make it happen without problems, a lot of systems also shorten them, e.g. GitLab's max length of SLUG is 63 bytes (https://docs.gitlab.com/ee/ci/variables/predefined_variables.html). Unfortunately, SLUG variables returned by this plugin are not shortened. Maybe it would be worth either:

  1. have a max length of SLUG predefined, or
  2. have a configuration option to define max SLUG length, or
  3. add a shortened version of SLUG env vars.

Warnings emitted when trigger is not a pull request

We're using workflow_dispatch trigger to run our workflow and therefore receive this warning twice when running franzdiebold/[email protected]:

Warning: Environment variable "GITHUB_HEAD_REF" not set. Cannot set "CI_HEAD_REF_SLUG".

This is because GITHUB_HEAD_REF is only set when the event trigger is a pull request: https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions

Perhaps some logic could be implemented to avoid setting CI_HEAD_REF_SLUG if GITHUB_HEAD_REF is not set?

Unable to find version `v1`

Just tried to setup my workflow to pick any 1.x.x version of the action by simply specifying @v1 instead of the exact version i.e. @v1.2.1 and got this error:

Unable to resolve action `FranzDiebold/github-env-vars-action@v1`, unable to find version `v1`

Isn't it supported by this action?

PS: Very handy action. Thanks!!

Avoid deprecated functions

When running the action you will see:

Warning: The `set-env` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands

cannot get correct short sha for pull requests

I have a workflow based on this:

on:
  pull_request:
    types: [opened, reopened, closed]

    steps:
      - name: GitHub Environment Variables Action
        uses: FranzDiebold/[email protected]

and I'm using SHA8: ${{ env.CI_SHA_SHORT }} in my job

however the resulting SHA is not something that I can use, it does not correspond to anything in the repo.

on a delete branch event, create var about deleted branch

on a delete branch event, github CI does not set information about deleted branch in envvar
instead, CI_REF_NAME is always valuated to , as delete workflow is executed on this branch
original branch is available at ${{ github.event.ref }}
It could be useful to have this data inside new envvars (if CI_EVENT_NAME==delete) CI_EVENT_REF_NAME & CI_EVENT_REF_NAME_SLUG
(in fact, in my used case, this is the slug version that interest me)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.