Skip to content

Commit

Permalink
[#1307] Added linting for GHAs. (#1308)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk authored May 3, 2024
1 parent 0926325 commit c43d585
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/close-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- name: Remove environment after a PR is closed
run: |
cat $GITHUB_EVENT_PATH | curl \
cat "$GITHUB_EVENT_PATH" | curl \
-X POST \
--header "Content-Type: application/json" \
--header "X-GitHub-Delivery: ${RUNNER_TRACKING_ID:7}" \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/scaffold-release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
release-docs:
environment:
name: github-pages
url: ${{ steps.pages.outputs.page_url }}

runs-on: ubuntu-latest

Expand Down
41 changes: 28 additions & 13 deletions .github/workflows/scaffold-test-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ jobs:

- name: Generate test SSH key pair used for deployment tests
run: |
mkdir -p $HOME/.ssh
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f $HOME/.ssh/id_rsa
chmod 600 $HOME/.ssh/id_rsa
echo "$(ssh-agent -a ${HOME}/ssh-agent.sock)" > ssh-agent-output
mkdir -p "$HOME/.ssh"
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f "$HOME/.ssh/id_rsa"
chmod 600 "$HOME/.ssh/id_rsa"
ssh-agent -a "${HOME}/ssh-agent.sock" > ssh-agent-output
export SSH_AUTH_SOCK=$(grep SSH_AUTH_SOCK ssh-agent-output | cut -d';' -f1 | cut -d= -f2)
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> "$GITHUB_ENV"
- name: Install dependencies
run: npm ci
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

drevops-test-workflow:
scaffold-test-workflow:
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -130,7 +130,7 @@ jobs:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

drevops-test-deployment:
scaffold-test-deployment:
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -162,12 +162,12 @@ jobs:

- name: Generate test SSH key pair used for deployment tests
run: |
mkdir -p $HOME/.ssh
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f $HOME/.ssh/id_rsa
chmod 600 $HOME/.ssh/id_rsa
echo "$(ssh-agent -a ${HOME}/ssh-agent.sock)" > ssh-agent-output
export SSH_AUTH_SOCK=$(grep SSH_AUTH_SOCK ssh-agent-output | cut -d';' -f1 | cut -d= -f2)
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV
mkdir -p "$HOME/.ssh"
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f "$HOME/.ssh/id_rsa"
chmod 600 "$HOME/.ssh/id_rsa"
ssh-agent -a "${HOME}/ssh-agent.sock" > ssh-agent-output
export SSH_AUTH_SOCK="$(grep SSH_AUTH_SOCK ssh-agent-output | cut -d';' -f1 | cut -d= -f2)"
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> "$GITHUB_ENV"
- name: Install dependencies
run: npm ci
Expand All @@ -189,3 +189,18 @@ jobs:
directory: /tmp/.scaffold-coverage-html
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

scaffold-test-actions:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check coding standards with yamllint
run: yamllint --config-file .scaffold/tests/.yamllint-for-gha.yml .github/workflows
continue-on-error: ${{ vars.DREVOPS_CI_YAMLLINT_IGNORE_FAILURE == '1' }}

- name: Check coding standards with actionlint
run: docker run --rm -v "${GITHUB_WORKSPACE:-.}":/app --workdir /app rhysd/actionlint:1.6.27 -ignore 'SC2002:' -ignore 'SC2155:'
continue-on-error: ${{ vars.DREVOPS_CI_ACTIONLINT_IGNORE_FAILURE == '1' }}
17 changes: 17 additions & 0 deletions .scaffold/tests/.yamllint-for-gha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Yamllint configuration file used to check GitHub Actions configuration files.
extends: default

rules:
comments:
min-spaces-from-content: 1
document-start:
present: false
empty-lines:
max: 1
max-start: 0
max-end: 0
line-length:
max: 255
truthy:
allowed-values: ['true', 'false']
check-keys: false

1 comment on commit c43d585

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.