Skip to content

Tests to run on .github folder update, to verify that all essential scripts are working correctly #86

Tests to run on .github folder update, to verify that all essential scripts are working correctly

Tests to run on .github folder update, to verify that all essential scripts are working correctly #86

name: Check github workflow
on:
push:
paths:
- ".github/**"
branches:
- main
pull_request:
branches:
- main
paths:
- ".github/**"
workflow_dispatch:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
shell:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: get reporter name
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- name: shellcheck
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: ${{ steps.reporter.outputs.value }}
path: |
.github/
cloud/storage/core/tools/ci/
pattern: "*.sh"
- name: shfmt
uses: librarian/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
python:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: get reporter name
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- name: set up python environment
uses: actions/[email protected]
with:
python-version: "3.10"
- name: set up dependencies
run: pip install flake8 black[jupyter] flake8-docstrings flake8-simplify flake8-unused-arguments flake8-quotes
- name: flake8
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
reporter: ${{ steps.reporter.outputs.value }}
flake8_args: "--max-line-length 128 --ignore Q000,D100,D101,D102,D103,D104,D105,D106,D107"
- name: black
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
reporter: ${{ steps.reporter.outputs.value }}
workflows:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: install action-validator with asdf
uses: asdf-vm/actions/install@v3
with:
tool_versions: |
action-validator 0.5.4
- name: check workflows syntax
id: lint
run: |
set -x
export TMP_OUT=$(mktemp)
find .github/workflows -type f \( -iname \*.yaml -o -iname \*.yml \) \
| xargs -I {} action-validator --verbose {} > $TMP_OUT
echo "WORKFLOW_LINT=$(cat $TMP_OUT | awk -v ORS='\\n' 1)"
cat $TMP_OUT >> "$GITHUB_STEP_SUMMARY"
echo "WORKFLOW_LINT=$(cat $TMP_OUT | awk -v ORS='\\n' 1)" >> "$GITHUB_OUTPUT"
- name: comment on issue
uses: actions/[email protected]
if: ${{ github.event_name == 'pull_request' }}
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.lint.outputs.WORKFLOW_LINT }}'
})
nbs-github-actions:
name: Launch scripts on test-data
uses: ./.github/workflows/github_actions_scripts.yaml
secrets: inherit