github-actions

How to get a branch name on GitHub action when push on a tag?

别说谁变了你拦得住时间么 提交于 2020-12-13 04:11:13
问题 I trigger my workflow using on: push: tags: GITHUB_REF won't contain a branch name in this case, how could I get it? 回答1: You will need to do a bit of string manipulation to get this going. Basically during a tag creation push, is like if you were to do git checkout v<tag> in your local but there's no reference to the original branch. This is why you will need to use the -r flag in the git branch contains command. We get the clean branch with the following two commands. raw=$(git branch -r -

How to get a branch name on GitHub action when push on a tag?

南笙酒味 提交于 2020-12-13 04:07:27
问题 I trigger my workflow using on: push: tags: GITHUB_REF won't contain a branch name in this case, how could I get it? 回答1: You will need to do a bit of string manipulation to get this going. Basically during a tag creation push, is like if you were to do git checkout v<tag> in your local but there's no reference to the original branch. This is why you will need to use the -r flag in the git branch contains command. We get the clean branch with the following two commands. raw=$(git branch -r -

How to get a branch name on GitHub action when push on a tag?

对着背影说爱祢 提交于 2020-12-13 04:07:21
问题 I trigger my workflow using on: push: tags: GITHUB_REF won't contain a branch name in this case, how could I get it? 回答1: You will need to do a bit of string manipulation to get this going. Basically during a tag creation push, is like if you were to do git checkout v<tag> in your local but there's no reference to the original branch. This is why you will need to use the -r flag in the git branch contains command. We get the clean branch with the following two commands. raw=$(git branch -r -

Why The Action Cannot Access Secrets?

纵饮孤独 提交于 2020-12-13 03:38:05
问题 I am trying to create a workflow to deploy Nuget packages to Github Package Repository using Github Actions. In this case, The repository is inside an organization I am the owner of that organization I have admin access to the repository The repository has secrets listed The commit is mine The commit is a direct commit to a branch But the action CANNOT access the secrets Below is the workflow I am trying to execute name: Build and Publish on: push: branches: - gh-packages jobs: build_and

Why The Action Cannot Access Secrets?

守給你的承諾、 提交于 2020-12-13 03:36:24
问题 I am trying to create a workflow to deploy Nuget packages to Github Package Repository using Github Actions. In this case, The repository is inside an organization I am the owner of that organization I have admin access to the repository The repository has secrets listed The commit is mine The commit is a direct commit to a branch But the action CANNOT access the secrets Below is the workflow I am trying to execute name: Build and Publish on: push: branches: - gh-packages jobs: build_and

How to get my own github events payload json for testing github actions locally?

柔情痞子 提交于 2020-12-13 03:28:54
问题 I use github actions and want to test it locally. I'm using this tools and it works fine. https://github.com/nektos/act I can provide a event.json for local testing, but it's really hard to create a real event payload. Is there any way to get real event payload? For example, I create pull request on my repository from the console, and get that event payload json. 回答1: To get event data, you can use a GitHub action to print the event to the log. # change this to the event type you want to get

GitHub action to simply cat a file to an output

泄露秘密 提交于 2020-12-12 14:55:50
问题 I want to cat the contents of my VERSION file (e.g. 0.9.0 ) into a variable and pass it to another GitHub action as input. However, from what I can tell, this requires creating a new GitHub action just to cat the file to an 'output' which could then be used as input to the next module. Is there a GitHub action that already does this - or is there some simpler solution I'm missing? 回答1: I don't think you need to create an action for this. cat should be usable in a run step. Try something like

how to reject a pull request if tests are failed github actions

不打扰是莪最后的温柔 提交于 2020-12-05 02:43:06
问题 I am doing npm test when pull requests are raised using Github actions . Now if tests fails , I would like to add a message or at least reject the PR using actions.. How can i do it? 回答1: I assume you have an on: pull_request workflow that runs npm test . This should automatically create a GitHub Check on the pull request that will fail if your tests fail. The best way to "reject" the pull request is to prevent it from being merged unless the tests pass. You can do this by turning on a

how to reject a pull request if tests are failed github actions

|▌冷眼眸甩不掉的悲伤 提交于 2020-12-05 02:42:50
问题 I am doing npm test when pull requests are raised using Github actions . Now if tests fails , I would like to add a message or at least reject the PR using actions.. How can i do it? 回答1: I assume you have an on: pull_request workflow that runs npm test . This should automatically create a GitHub Check on the pull request that will fail if your tests fail. The best way to "reject" the pull request is to prevent it from being merged unless the tests pass. You can do this by turning on a

Caching npm dependency with github action

随声附和 提交于 2020-12-02 20:47:41
问题 I want to cache npm dependencies so that I does not do npm install every time I push and instead just load it from cache. I think github action support this now?: How do I cache steps in GitHub actions? Here are few cases If package.json changes, which means yarn.lock or package-lock.json changed so do npm install and update cache Extending my above point, the contributor could be doing both yarn install and npm install From the same above question, I changed my github action to something