Skip to content

Commit cc61963

Browse files
authored
Merge pull request #51 from Expensify/cole/actionlint-default
Use Github-Actions action lint config if one is not present in the repo
2 parents 2b08a2f + 98c2412 commit cc61963

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

.github/workflows/cla.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
CLA:
12-
runs-on: ubuntu-latest
12+
runs-on: blacksmith-2vcpu-ubuntu-2404
1313
# This job should only run for pull request comments or pull request target events (not issue comments)
1414
if: github.event.issue.pull_request || github.event_name == 'pull_request_target'
1515
steps:

.github/workflows/npmPublish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121

2222
jobs:
2323
publish:
24-
runs-on: ubuntu-latest
24+
runs-on: blacksmith-2vcpu-ubuntu-2404
2525
permissions:
2626
contents: read
2727
id-token: write # Required for OIDC: https://docs.npmjs.com/trusted-publishers

.github/workflows/shellCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
lint:
1111
if: ${{ github.actor != 'OSBotify' || github.event_name == 'workflow_call' }}
12-
runs-on: ubuntu-latest
12+
runs-on: blacksmith-2vcpu-ubuntu-2404
1313
steps:
1414
- name: Checkout
1515
# 4.2.2

.github/workflows/validateActions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on: pull_request
99

1010
jobs:
1111
validateSchemas:
12-
runs-on: ubuntu-latest
12+
runs-on: blacksmith-2vcpu-ubuntu-2404
1313
if: ${{ !contains(github.actor, '[bot]') && github.actor != 'MelvinBot' && github.actor != 'botify' && github.actor != 'OSBotify' }}
1414
steps:
1515
- name: Checkout repos
@@ -34,7 +34,7 @@ jobs:
3434
run: echo "::error::The validateWorkflowSchemas check failed! To run it locally, go to the root of ${{ steps.repo.outputs.NAME }} and run <path_to_github_actions_repo>/scripts/validateWorkflowSchemas.sh"
3535

3636
actionlint:
37-
runs-on: ubuntu-latest
37+
runs-on: blacksmith-2vcpu-ubuntu-2404
3838
if: ${{ !contains(github.actor, '[bot]') && github.actor != 'MelvinBot' && github.actor != 'botify' && github.actor != 'OSBotify' }}
3939
steps:
4040
- name: Checkout repos
@@ -51,7 +51,7 @@ jobs:
5151
run: echo "::error::The actionlint check failed! To run it locally, go to the root of ${{ steps.repo.outputs.NAME }} and run <path_to_github_actions_repo>/scripts/actionlint.sh"
5252

5353
validateImmutableActionRefs:
54-
runs-on: ubuntu-latest
54+
runs-on: blacksmith-2vcpu-ubuntu-2404
5555
if: ${{ !contains(github.actor, '[bot]') && github.actor != 'MelvinBot' && github.actor != 'botify' && github.actor != 'OSBotify' }}
5656
steps:
5757
- name: Checkout repos

scripts/actionlint.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,18 @@ fi
119119
info "Linting workflows..."
120120
echo
121121
cd "$REPO_ROOT" || exit 1
122-
if ! "$ACTIONLINT_PATH" -color; then
122+
123+
# If a repo has it's own action lint config, use that. Otherwise, use the one in this repo.
124+
CONFIG=""
125+
if [[ ! -f "$REPO_ROOT/.github/actionlint.yml" ]] && [[ ! -f "$REPO_ROOT/.github/actionlint.yaml" ]]; then
126+
CONFIG=" -config-file $(readlink -f "$SCRIPT_DIR"/../.github/actionlint.yml)"
127+
info "Using default Github-Actions repo actionlint.yml" >&2
128+
fi
129+
130+
# We can't quote CONFIG here because we need the splitting on spaces for it to be recognized
131+
# by actionlint as a flag
132+
#shellcheck disable=SC2086
133+
if ! "$ACTIONLINT_PATH" ${CONFIG} -color; then
123134
error "Workflows did not pass actionlint :("
124135
exit 1
125136
fi

0 commit comments

Comments
 (0)