Skip to content

Commit

Permalink
Merge pull request #392 from Yoast/JRF/ghactions-add-actionlint
Browse files Browse the repository at this point in the history
GH Actions: add actionlint job
  • Loading branch information
jrfnl authored Dec 24, 2024
2 parents 6f7af74 + 641d6b2 commit ae10d44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ on:
- 'phpunit-wp.xml.dist'
- 'yarn.lock'
- '.github/dependabot.yml'
- '.github/workflows/deploy.yml'
- '.github/workflows/lint.yml'
- '.github/workflows/test.yml'
- 'config/**'
- '!config/composer/actions.php'
- 'css/**'
Expand All @@ -47,9 +44,6 @@ on:
- 'phpunit-wp.xml.dist'
- 'yarn.lock'
- '.github/dependabot.yml'
- '.github/workflows/deploy.yml'
- '.github/workflows/lint.yml'
- '.github/workflows/test.yml'
- 'config/**'
- '!config/composer/actions.php'
- 'css/**'
Expand All @@ -64,6 +58,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 @@ -78,11 +76,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=trunk' >> $GITHUB_OUTPUT
echo "REF=origin/trunk" >> $GITHUB_OUTPUT
echo 'NAME=trunk' >> "$GITHUB_OUTPUT"
echo "REF=origin/trunk" >> "$GITHUB_OUTPUT"
fi
- name: Fetch base branch
Expand Down Expand Up @@ -117,7 +115,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
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,22 +144,22 @@ jobs:
SHA: ${{ github.sha }}
run: |
shortsha=$(echo "$SHA" | cut -b 1-6)
echo "SHORTSHA=$shortsha" >> $GITHUB_OUTPUT
echo "SHORTSHA=$shortsha" >> "$GITHUB_OUTPUT"
- name: "Set variables: target branch, commit title"
id: set_vars
env:
REF_NAME: ${{ github.ref_name }}
run: |
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref_type }}" == 'branch' && "$REF_NAME" != "${{ env.DIST_DEFAULT_BRANCH }}" ]]; then
echo "BRANCH=$REF_NAME" >> $GITHUB_OUTPUT
echo "TITLE=Syncing branch $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> $GITHUB_OUTPUT
echo "BRANCH=$REF_NAME" >> "$GITHUB_OUTPUT"
echo "TITLE=Syncing branch $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> "$GITHUB_OUTPUT"
elif [[ "${{ github.event_name }}" == 'workflow_dispatch' && "$REF_NAME" != "${{ env.DIST_DEFAULT_BRANCH }}" ]]; then
echo "BRANCH=$REF_NAME" >> $GITHUB_OUTPUT
echo "TITLE=Manual deploy for $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> $GITHUB_OUTPUT
echo "BRANCH=$REF_NAME" >> "$GITHUB_OUTPUT"
echo "TITLE=Manual deploy for $REF_NAME (sha: ${{ steps.set_sha.outputs.SHORTSHA }})" >> "$GITHUB_OUTPUT"
else # = Pushed tag.
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"
fi
- name: Checkout Yoast Dist repo
Expand Down Expand Up @@ -254,7 +254,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 ae10d44

Please sign in to comment.