Skip to content

Commit

Permalink
GH Actions: add actionlint job
Browse files Browse the repository at this point in the history
This job checks the GH Actions workflows against syntax errors and other problems.

Includes minor fixes to pre-existing workflows to allow the build to pass.
  • Loading branch information
jrfnl committed Dec 21, 2024
1 parent 38b4b4c commit 22f6a11
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ on:
- 'composer.lock'
- '.phpcs.xml.dist'
- 'phpcs.xml.dist'
- '.github/workflows/cs.yml'
- '.github/workflows/**'
pull_request:
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
- '.phpcs.xml.dist'
- 'phpcs.xml.dist'
- '.github/workflows/cs.yml'
- '.github/workflows/**'
# Allow manually triggering the workflow.
workflow_dispatch:

Expand All @@ -30,6 +30,10 @@ concurrency:
cancel-in-progress: true

jobs:
actionlint:
name: 'Lint GH Action workflows'
uses: Yoast/.github/.github/workflows/reusable-actionlint.yml@main

checkcs:
name: 'Check code style'
runs-on: ubuntu-latest
Expand All @@ -44,11 +48,11 @@ jobs:
BASE_REF: ${{ github.base_ref }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "NAME=$BASE_REF" >> $GITHUB_OUTPUT
echo "REF=origin/$BASE_REF" >> $GITHUB_OUTPUT
echo "NAME=$BASE_REF" >> "$GITHUB_OUTPUT"
echo "REF=origin/$BASE_REF" >> "$GITHUB_OUTPUT"
else
echo 'NAME=develop' >> $GITHUB_OUTPUT
echo "REF=origin/develop" >> $GITHUB_OUTPUT
echo 'NAME=develop' >> "$GITHUB_OUTPUT"
echo "REF=origin/develop" >> "$GITHUB_OUTPUT"
fi
- name: Fetch base branch
Expand Down Expand Up @@ -83,7 +87,7 @@ jobs:
set +e
composer check-cs-thresholds
exitcode="$?"
echo "EXITCODE=$exitcode" >> $GITHUB_OUTPUT
echo "EXITCODE=$exitcode" >> "$GITHUB_OUTPUT"
exit "$exitcode"
# Check the codestyle only of the files which were changed in the current branch.
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ jobs:
REF_NAME: ${{ github.ref_name }}
run: |
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref_type }}" == 'tag' ]]; then
echo "BRANCH=${{ env.DIST_DEFAULT_BRANCH }}" >> $GITHUB_OUTPUT
echo "TITLE=Release $REF_NAME" >> $GITHUB_OUTPUT
echo "BRANCH=${{ env.DIST_DEFAULT_BRANCH }}" >> "$GITHUB_OUTPUT"
echo "TITLE=Release $REF_NAME" >> "$GITHUB_OUTPUT"
else # = manually triggered.
echo "BRANCH=$REF_NAME" >> $GITHUB_OUTPUT
echo "TITLE=Manual deploy for $REF_NAME" >> $GITHUB_OUTPUT
echo "BRANCH=$REF_NAME" >> "$GITHUB_OUTPUT"
echo "TITLE=Manual deploy for $REF_NAME" >> "$GITHUB_OUTPUT"
fi
- name: Checkout Yoast Dist repo
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
env:
REF_NAME: ${{ github.ref_name }}
run: git tag "$REF_NAME" $(git rev-parse HEAD)
run: git tag "$REF_NAME" "$(git rev-parse HEAD)"

- name: Push to target branch
run: git push -u origin ${{ steps.set_vars.outputs.BRANCH }} --tags -v

0 comments on commit 22f6a11

Please sign in to comment.