ci: trigger apps_version_check via workflow_run

This commit is contained in:
Ivan Dyachkov 2023-07-19 11:18:23 +02:00
parent 8139804f1e
commit 1566edd50c
4 changed files with 59 additions and 7 deletions

View File

@ -0,0 +1,41 @@
name: 'Download artifact from another workflow in a workflow triggered by workflow_run'
inputs:
artifact_name:
required: true
type: string
default: 'emqx-source'
archive_format:
required: false
type: string
default: 'zip'
defaults:
run:
shell: 'bash -Eeuo pipefail {0}'
runs:
using: composite
steps:
- name: Download artifact
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "${{ inputs.artifact_name }}"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: '${{ inputs.archive_format }}',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/data.zip`, Buffer.from(download.data));
- name: Unzip artifact
shell: bash
run: unzip -o -q data.zip

View File

@ -29,6 +29,9 @@ runs:
apt-get install -y shellcheck
./scripts/shellcheck.sh
echo "success"
- name: Ensure rebar
shell: bash
run: make ensure-rebar3
- name: Check Erlang code formatting
shell: bash
run: ./scripts/check-format.sh

View File

@ -1,11 +1,10 @@
name: PR Entrypoint
on:
push:
pull_request:
jobs:
entrypoint:
sanity-checks:
runs-on: aws-amd64
container: ghcr.io/emqx/emqx-builder/5.1-1:1.14.5-25.3.2-1-ubuntu22.04
@ -14,4 +13,9 @@ jobs:
with:
fetch-depth: 0
- uses: ./.github/actions/pr-sanity-checks
- uses: actions/upload-artifact@v3
with:
name: emqx-source
path: .
retention-days: 1

View File

@ -1,14 +1,18 @@
name: Check Apps Version
# on: [pull_request]
on:
workflow_run:
workflows:
- PR Entrypoint
types:
- completed
jobs:
check_apps_version:
runs-on: ubuntu-22.04
runs-on: aws-amd64
if: github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/download-artifact
- name: Check apps version
run: ./scripts/apps-version-check.sh