diff --git a/.github/workflows/validateActions.yml b/.github/workflows/validateActions.yml index ff6a28a..f3684b2 100644 --- a/.github/workflows/validateActions.yml +++ b/.github/workflows/validateActions.yml @@ -1,14 +1,11 @@ +# Note: This workflow is configured to run on all pull requests throughout the Expensify org, not just this repo. +# That has a few consequences: +# - We need to checkout the repo it's running on, and not just the GitHub-Actions repo +# - branch and path matching does not work in the workflow layer. From the docs: https://docs.github.com/en/enterprise-cloud@latest/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#supported-event-triggers +# > Any filters you specify for the supported events are ignored - for example, branches, branches-ignore, paths, types and so on. The workflow is only triggered, and is always triggered, by the default activity types of the supported events name: Validate Github Actions and Workflows -on: - pull_request: - types: [opened, synchronize] - branches-ignore: [staging, production] - paths: - - '.github/workflows/*.yml' - - '.github/workflows/*.yaml' - - '**/action.yml' - - '**/action.yaml' +on: pull_request jobs: validateSchemas: diff --git a/scripts/actionlint.sh b/scripts/actionlint.sh index d2089fe..84ceb99 100755 --- a/scripts/actionlint.sh +++ b/scripts/actionlint.sh @@ -21,6 +21,14 @@ source "$SCRIPT_DIR/shellUtils.sh" title "Lint Github Actions via actionlint (https://github.com/rhysd/actionlint)" +# Make sure there are workflows or actions to check before downloading and running actionlint +WORKFLOWS="$(find "$REPO_ROOT/.github/workflows" -type f \( -name "*.yml" -o -name "*.yaml" \))" +ACTIONS="$(find "$REPO_ROOT" -type f \( -name "action.yml" -o -name "action.yaml" \))" +if [[ -z "$WORKFLOWS" && -z "$ACTIONS" ]]; then + success "No workflows or actions to check!" + exit 0 +fi + # Get the actionlint tarball name from the checksums file, used both for downloading and verifying checksums OS="$(uname)" ARCH="$(uname -m)"