Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add actionlint (#270)

sarayourfriend8397254fe5d8
diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json
new file mode 100644
index 000000000..a99709f71
--- /dev/null
+++ b/.github/actionlint-matcher.json
@@ -0,0 +1,17 @@
+{
+ "problemMatcher": [
+ {
+ "owner": "actionlint",
+ "pattern": [
+ {
+ "code": 5,
+ "column": 3,
+ "file": 1,
+ "line": 2,
+ "message": 4,
+ "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*:(?:\\x1b\\[\\d+m)*(\\d+)(?:\\x1b\\[\\d+m)*: (?:\\x1b\\[\\d+m)*(.+?)(?:\\x1b\\[\\d+m)* \\[(.+?)\\]$"
+ }
+ ]
+ }
+ ]
+}
diff --git a/.github/sync.yml b/.github/sync.yml
index b5c4c7285..38a7854ab 100644
--- a/.github/sync.yml
+++ b/.github/sync.yml
@@ -22,6 +22,10 @@ group:
dest: .github/workflows/pr_label_check.yml
- source: .github/workflows/pr_ping.yml
dest: .github/workflows/pr_ping.yml
+ - source: .github/workflows/actionlint.yml
+ dest: .github/workflows/actionlint.yml
+ - source: .github/actionlint-matcher.json
+ dest: .github/actionlint-matcher.json
# Downstream workflows
- source: .github/workflows_downstream/draft_release.yml
dest: .github/workflows/draft_release.yml
diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml
new file mode 100644
index 000000000..9bb0d9c9c
--- /dev/null
+++ b/.github/workflows/actionlint.yml
@@ -0,0 +1,19 @@
+name: Lint GitHub Actions workflows
+
+on:
+ pull_request:
+ push:
+ branches:
+ - main
+
+jobs:
+ actionlint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - name: Check workflow files
+ run: |
+ echo "::add-matcher::.github/actionlint-matcher.json"
+ bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/v1.6.15/scripts/download-actionlint.bash)
+ ./actionlint -color
+ shell: bash
diff --git a/.github/workflows/discussion_ping.yml b/.github/workflows/discussion_ping.yml
index df52c5a23..243eedec7 100644
--- a/.github/workflows/discussion_ping.yml
+++ b/.github/workflows/discussion_ping.yml
@@ -21,7 +21,7 @@ jobs:
- name: Send notification for new discussion
run: |
curl \
- $slack_url \
+ "$slack_url" \
-X POST \
-H 'Content-Type: application/json' \
-d '{"text":"New discussion opened by '"$discussion_author"' in '"$discussion_repo"': #'"$discussion_number"' - '"$discussion_title"'","blocks":[{"type":"section","text":{"type":"mrkdwn","text":":github: New discussion opened by *'"$discussion_author"'* in `'"$discussion_repo"'`:\n<'"$discussion_url"'|#'"$discussion_number"' - '"$discussion_title"'>"}}]}'
diff --git a/.github/workflows/label_pr.yml b/.github/workflows/label_pr.yml
index 85ad7aba2..ac08dcbb9 100644
--- a/.github/workflows/label_pr.yml
+++ b/.github/workflows/label_pr.yml
@@ -36,4 +36,4 @@ jobs:
working-directory: ./automations/python
run: |
pipenv run python label_pr.py \
- --pr-url $PR_URL
+ --pr-url "$PR_URL"
diff --git a/.github/workflows/pr_ping.yml b/.github/workflows/pr_ping.yml
index 500dfecd3..41c8f1adf 100644
--- a/.github/workflows/pr_ping.yml
+++ b/.github/workflows/pr_ping.yml
@@ -29,7 +29,7 @@ jobs:
pr_icon: ${{ github.event.pull_request.draft && ':pr-draft:' || ':pull-request:' }}
run: |
curl \
- $slack_url \
+ "$slack_url" \
-X POST \
-H 'Content-Type: application/json' \
-d '{"text":"New'"$pr_status"'PR opened by '"$pr_author"' in '"$pr_repo"': #'"$pr_number"' - '"$pr_title"'","blocks":[{"type":"section","text":{"type":"mrkdwn","text":"'"$pr_icon"' New'"$pr_status"'PR opened by *'"$pr_author"'* in `'"$pr_repo"'`:\n<'"$pr_url"'|#'"$pr_number"' - '"$pr_title"'>"}}]}'
@@ -38,7 +38,7 @@ jobs:
if: github.event.action == 'ready_for_review'
run: |
curl \
- $slack_url \
+ "$slack_url" \
-X POST \
-H 'Content-Type: application/json' \
-d '{"text":"PR by '"$pr_author"' in '"$pr_repo"' marked ready for review: #'"$pr_number"' - '"$pr_title"'","blocks":[{"type":"section","text":{"type":"mrkdwn","text":":pull-request: PR by *'"$pr_author"'* in `'"$pr_repo"'` marked ready for review:\n<'"$pr_url"'|#'"$pr_number"' - '"$pr_title"'>"}}]}'