-
Notifications
You must be signed in to change notification settings - Fork 119
63 lines (59 loc) · 2.59 KB
/
Copy pathcodespell.yml
File metadata and controls
63 lines (59 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Codespell configuration is within .codespellrc
---
name: Codespell
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
requested:
description: Run this workflow for an authorized /citest command
required: true
type: boolean
permissions:
contents: read
pull-requests: read
# This is required for the ability to create/update the Pull request status
statuses: write
jobs:
codespell:
if: inputs.requested || github.event_name != 'issue_comment'
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Get PR head SHA and context
if: github.event_name == 'issue_comment'
id: head_sha_context
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.issue.number }}
CONTEXT: "${{ github.workflow }} / Check for spelling errors (pull_request)"
run: |
set -euxo pipefail
head_sha=$(gh api "repos/$REPO/pulls/$PR_NUMBER" --jq '.head.sha')
echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"
echo "context=$CONTEXT" >> "$GITHUB_OUTPUT"
- name: Set commit status as pending
if: github.event_name == 'issue_comment'
uses: myrotvorets/set-commit-status-action@b374c10a0639fcecd00109b579be23e4878a9b5f # master
with:
sha: ${{ steps.head_sha_context.outputs.head_sha }}
status: pending
context: ${{ steps.head_sha_context.outputs.context }}
description: Test started
targetUrl: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
ref: ${{ steps.head_sha_context.outputs.head_sha || github.sha }}
- name: Codespell
uses: codespell-project/actions-codespell@e3258cca84ce02b0bb36a3d41f2c18f719a0cc1a # v2.4.3
- name: Set final commit status
if: always() && github.event_name == 'issue_comment' && steps.head_sha_context.outputs.head_sha != ''
uses: myrotvorets/set-commit-status-action@b374c10a0639fcecd00109b579be23e4878a9b5f # master
with:
sha: ${{ steps.head_sha_context.outputs.head_sha }}
status: ${{ job.status }}
context: ${{ steps.head_sha_context.outputs.context }}
description: Test finished
targetUrl: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/job/${{ job.check_run_id }}