github-actions

How to fail a job in Github Actions?

流过昼夜 提交于 2020-06-12 08:06:16
问题 I'm developing a Github actions workflow. This workflow runs on Linux, Mac and Windows. As part of the workflow, I have to check whether 2 environment variables are equal. If they doesn't - fail the job. As described here, Github Actions support if: condition: steps: - run: # How can if make a cross platform failure here? if: ${{ envA }} != ${{ envB }} How can I make the job fail, if the above condition is true? At the beginning, I thought on a script, but there must be a more elegant way to

Download private module from Github Package Registry via Yarn within a Github Action? Publishing works, but installing is met with '401 Unauthorized'

我与影子孤独终老i 提交于 2020-06-12 05:40:31
问题 For various reasons we are stuck using yarn managing our packages so we can't rely on a package-lock.json to use npm with github actions. We cannot get Yarn to authenticate as part of a github action. We've got our repo npmrc configured as: @COMPANY:registry=https://npm.pkg.github.com registry=https://registry.npmjs.org/ And we're using this action for yarn. Here's a basic setup where we're just trying to install the modules -- nothing more. name: CI on: [push] jobs: build: name: Test runs-on

Workaround to post comments from GitHub actions from forked repos

北城余情 提交于 2020-06-09 05:43:25
问题 I need to post comments to GitHub pull request after GitHub action completes, e.g. when a FOSS community member submits a PR. I know that when an action runs from a forked repo, the token has no write access to the parent repo, so it cannot post a comment. Are there any viable workarounds that people have found for this? 回答1: I couldn't find any ready-made actions, so here's a complete code to work around GitHub Actions' limitation, written in bash + jq + curl, and calling GitHub API directly

Workaround to post comments from GitHub actions from forked repos

倾然丶 夕夏残阳落幕 提交于 2020-06-09 05:43:08
问题 I need to post comments to GitHub pull request after GitHub action completes, e.g. when a FOSS community member submits a PR. I know that when an action runs from a forked repo, the token has no write access to the parent repo, so it cannot post a comment. Are there any viable workarounds that people have found for this? 回答1: I couldn't find any ready-made actions, so here's a complete code to work around GitHub Actions' limitation, written in bash + jq + curl, and calling GitHub API directly

Change variables in appsettings when deploying with github actions

╄→尐↘猪︶ㄣ 提交于 2020-05-31 02:35:08
问题 I am trying to deploy an app with github actions. I linked my azure account to my github repository and the following actions has been created: name: Build and deploy ASP.Net Core app to Azure Web App - my_app_name on: push: branches: - master jobs: build-and-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Set up .NET Core uses: actions/setup-dotnet@v1 with: dotnet-version: '3.1.102' - name: Build with dotnet run: dotnet build --configuration Release - name:

Change variables in appsettings when deploying with github actions

我的梦境 提交于 2020-05-31 02:32:40
问题 I am trying to deploy an app with github actions. I linked my azure account to my github repository and the following actions has been created: name: Build and deploy ASP.Net Core app to Azure Web App - my_app_name on: push: branches: - master jobs: build-and-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: Set up .NET Core uses: actions/setup-dotnet@v1 with: dotnet-version: '3.1.102' - name: Build with dotnet run: dotnet build --configuration Release - name:

How can I get the previous commit before a push or merge in GitHub Action workflow?

故事扮演 提交于 2020-05-30 04:11:40
问题 I'm using Nx for monorepo support on a new project. One of the benefits of Nx is that it can determine which apps in the monorepo are affected by a range of changes (start commit, end commit). So if you have a bunch of apps, you only have to build, test, and deploy the apps that are actually affected by the changes instead of the entire monorepo. I'd like to setup a GitHub Action workflow to deploy only the affected apps on push or merge to master. However, I'm having trouble figuring out how

Using output from a previous job in a new one in a GitHub Action

无人久伴 提交于 2020-05-27 04:30:26
问题 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: windows-latest steps: - name: Maybe greet id: maybe-greet env: HEY: "Hey you!" GREETING: "Merry Xmas to you too!" BODY: ${{ github.event.issue.body }} run: | $output=(perl -e 'print ($ENV{BODY} =~ /Merry/)?$ENV{GREETING}:$ENV{HEY};') Write-Output "::set-output name=GREET::$output" produce_comment: name:

Have a unique check-run for github actions workflow

牧云@^-^@ 提交于 2020-05-26 12:26:33
问题 I'm trying to enforce labelling PR's using enforce-label-action. name: Enforce PR label on: pull_request: types: [labeled, unlabeled, opened, edited] jobs: enforce-label: runs-on: ubuntu-latest steps: - uses: yogevbd/enforce-label-action@master with: REQUIRED_LABELS_ANY: "bug,enhancement,feature" The problem is that each time PR is labeled, a new check-run getting created and the old one's still having a failing status which cause the check-suite to show: Some checks were not successful . Is

Caching APT packages in GitHub Actions workflow

|▌冷眼眸甩不掉的悲伤 提交于 2020-05-25 17:06:45
问题 I use the following Github Actions workflow for my C project. The workflow finishes in ~40 seconds, but more than half of that time is spent by installing the valgrind package and its dependencies. I believe caching could help me speed up the workflow. I do not mind waiting a couple of extra seconds, but this just seems like a pointless waste of GitHub's resources. name: C Workflow on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: make run