Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix honoring skip phrases #217

Merged
merged 47 commits into from
Mar 12, 2024
Merged
Changes from 18 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a3c55ac
Update
walkowif Feb 27, 2024
7bd7718
Update
walkowif Feb 27, 2024
30705ba
Update
walkowif Feb 27, 2024
76945b2
Update
walkowif Feb 27, 2024
af28da4
Update
walkowif Feb 27, 2024
2586179
Update
walkowif Feb 27, 2024
dba05bb
Update
walkowif Feb 27, 2024
52cfe77
Update
walkowif Feb 27, 2024
6ff3db5
Update
walkowif Feb 28, 2024
ef7f841
Update
walkowif Feb 29, 2024
6bc2d85
Update
walkowif Feb 29, 2024
52d993e
Update
walkowif Feb 29, 2024
6501667
Try another method
walkowif Mar 1, 2024
6ea8e5a
Update
walkowif Mar 1, 2024
b17c404
Try cancelling with gh
walkowif Mar 1, 2024
c03dbaa
Update
walkowif Mar 1, 2024
6d86738
Update
walkowif Mar 1, 2024
4103f38
Update
walkowif Mar 4, 2024
120d8b4
Use action to install gh CLI
walkowif Mar 4, 2024
9f27958
Update
walkowif Mar 4, 2024
d8b905f
Cleanup
walkowif Mar 4, 2024
c9545c4
Cleanup
walkowif Mar 4, 2024
c4aaddd
Merge branch 'main' into debug-skip-phrases
cicdguy Mar 4, 2024
4a0014f
Update
walkowif Mar 7, 2024
a18b9e5
Merge branch 'debug-skip-phrases' of github.com:insightsengineering/r…
walkowif Mar 7, 2024
02e398f
Update
walkowif Mar 7, 2024
92c0a20
Update
walkowif Mar 7, 2024
dcf5419
Update workflows
walkowif Mar 7, 2024
ece8894
Update
walkowif Mar 7, 2024
e2357b3
Update
walkowif Mar 7, 2024
7090e03
Update
walkowif Mar 7, 2024
4ecbb51
Update
walkowif Mar 7, 2024
41a2f62
Update
walkowif Mar 7, 2024
0c8acc1
Show github context
walkowif Mar 7, 2024
7058cb4
Update
walkowif Mar 7, 2024
f49f72a
Update
walkowif Mar 7, 2024
51a1f3a
Get github context for push event
walkowif Mar 7, 2024
27b1d42
Update
walkowif Mar 7, 2024
31924f7
Cleanup
walkowif Mar 7, 2024
7d03539
Exit the job instead of cancelling the workflow
walkowif Mar 8, 2024
1897cb4
Try commit-message-checker
walkowif Mar 8, 2024
987a5ec
Cleanup
walkowif Mar 8, 2024
e94134d
Merge branch 'main' into debug-skip-phrases
walkowif Mar 8, 2024
f70c554
Restore job conditions
walkowif Mar 8, 2024
af4b52a
Cleanup
walkowif Mar 8, 2024
9ac1709
Test exit code = 0
walkowif Mar 8, 2024
4232ae1
Revert "Test exit code = 0"
walkowif Mar 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 56 additions & 3 deletions .github/workflows/spelling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,43 @@ concurrency:
cancel-in-progress: true

jobs:
# check-skip-instructions:
# name: Check skip instructions ⚙️
# runs-on: ubuntu-latest
# outputs:
# head-commit-message: ${{ steps.get-commit-message.outputs.head_commit_message }}
# steps:
# - name: Checkout Code 🛎
# uses: actions/checkout@v4
# with:
# fetch-depth: 1
# ref: ${{ github.event.pull_request.head.sha }}

# - name: Get commit message 💬
# id: get-commit-message
# run: |
# echo "head_commit_message=$(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')" >> $GITHUB_OUTPUT
# echo "head_commit_message = $(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')"
# shell: bash

spelling:
name: Check spelling 🔠
runs-on: ubuntu-latest
# needs: check-skip-instructions
if: >
!contains(github.event.commits[0].message, '[skip spelling]')
&& github.event.pull_request.draft == false
github.event.pull_request.draft == false
# if: >
# !contains(needs.check-skip-instructions.outputs.head-commit-message, '[skip spelling]')
# && github.event.pull_request.draft == false
container:
image: ghcr.io/insightsengineering/rstudio:latest

steps:
# - name: Debug
# run: |
# echo "skip_spelling = ${{ contains(needs.check-skip-instructions.outputs.head-commit-message, '[skip spelling]') }}"
# echo "head_commit_message = ${{ needs.check-skip-instructions.outputs.head-commit-message }}"

- name: Setup token 🔑
id: github-token
run: |
Expand All @@ -60,8 +87,35 @@ jobs:

- name: Checkout Code 🛎
uses: actions/checkout@v4
if: github.event_name != 'push'
with:
token: ${{ steps.github-token.outputs.token }}
fetch-depth: 1
ref: ${{ github.event.pull_request.head.sha }}

- name: Checkout Code 🛎
uses: actions/checkout@v4
if: github.event_name == 'push'
with:
token: ${{ steps.github-token.outputs.token }}

- name: Get commit message 💬
id: get-commit-message
run: |
git config --global --add safe.directory $(pwd)
export head_commit_message="$(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')"
echo "head_commit_message=$(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')" >> $GITHUB_OUTPUT
echo "head_commit_message = $(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')"
if [[ $head_commit_message == *"[skip spelling]"* ]]; then
echo "Skip instruction detected - cancelling the workflow."
curl -s -LJ -o gh.tar.gz https://github.com/cli/cli/releases/download/v2.44.1/gh_2.44.1_linux_amd64.tar.gz
tar -xzf gh.tar.gz --strip-components 2
./gh run cancel ${{ github.run_id }}
./gh run watch ${{ github.run_id }}
fi
walkowif marked this conversation as resolved.
Show resolved Hide resolved
shell: bash
env:
GH_TOKEN: ${{ steps.github-token.outputs.token }}

- name: Normalize variables 📏
run: |
Expand Down Expand Up @@ -91,7 +145,6 @@ jobs:
- name: Checkout to main 🛎
if: github.event_name == 'push'
run: |
git config --global --add safe.directory $(pwd)
git fetch origin main
git checkout main
git pull origin main
Expand Down