https://github.com/technote-space/download-annotations-action
GitHub actions to download annotations
https://github.com/technote-space/download-annotations-action
annotations github-actions
Last synced: 2 months ago
JSON representation
GitHub actions to download annotations
- Host: GitHub
- URL: https://github.com/technote-space/download-annotations-action
- Owner: technote-space
- License: mit
- Created: 2020-12-09T06:31:31.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-24T17:31:33.000Z (over 1 year ago)
- Last Synced: 2025-04-13T21:53:18.384Z (2 months ago)
- Topics: annotations, github-actions
- Language: TypeScript
- Homepage:
- Size: 5.72 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.ja.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Download Annotations Action
[](https://github.com/technote-space/download-annotations-action/actions)
[](https://codecov.io/gh/technote-space/download-annotations-action)
[](https://www.codefactor.io/repository/github/technote-space/download-annotations-action)
[](https://github.com/technote-space/download-annotations-action/blob/main/LICENSE)*Read this in other languages: [English](README.md), [日本語](README.ja.md).*
GitHub actions to download annotations.
## Table of Contents
Details
- [使用方法](#%E4%BD%BF%E7%94%A8%E6%96%B9%E6%B3%95)
- [Options](#options)
- [Outputs](#outputs)
- [number](#number)
- [messages](#messages)
- [path](#path)
- [result_path](#result_path)
- [Author](#author)## 使用方法
例:`.github/workflows/check-warnings.yml`
```yaml
on:
workflow_run:
workflows:
- Workflow name1
- Workflow name2
# ...
types:
- completedname: Check Warnings
jobs:
annotations:
name: Annotations
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: technote-space/download-annotations-action@v1
id: annotations
with:
TARGET_RUN_ID: ${{ github.event.workflow_run.id }}
INCLUDE_LEVELS: warning
# EXCLUDE_MESSAGE_PATTERNS: |
# *warning jest*
- name: Build attachments
run: |
arr1='[{"fields":[{"title":"repo","value":"","short":true},{"title":"action","value":"<${{ github.event.workflow_run.html_url }}|action>","short":true}]}]'
arr2=$(echo '${{ steps.annotations.outputs.messages }}' | jq -c 'map({"color":"warning","text":"```\(.)```"})')
echo "SLACK_ATTACHMENTS=$(jq --argjson arr1 "$arr1" --argjson arr2 "$arr2" -nc '$arr1 + $arr2')" >> $GITHUB_ENV
if: steps.annotations.outputs.number > 0
- uses: 8398a7/action-slack@v3
with:
status: custom
fields: repo
custom_payload: |
{
text: "Warning annotations",
attachments: ${{ env.SLACK_ATTACHMENTS }}
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: steps.annotations.outputs.number > 0 && env.SLACK_WEBHOOK_URL
```
## Options
詳細は [actions.yml](./action.yml)## Outputs
### number
annotation の数例:
```shell script
echo ${{ steps.annotations.outputs.messages }}
``````shell script
1
```### messages
すべての annotation のメッセージ例:
```shell script
echo '${{ steps.annotations.outputs.number }}' | jq
``````shell script
[
"Warning test message",
"Failure test message",
"Notice test message"
]
```### path
annotation のファイルパス例:
```json
[
{
"path": "README.md",
"start_line": 2,
"end_line": 2,
"start_column": 5,
"end_column": 10,
"annotation_level": "warning",
"title": "Warning test",
"message": "Warning test message",
"raw_details": "Warning test details",
"blob_href": "https://api.github.com/repos/github/rest-api-description/git/blobs/abc"
},
{
"path": "README.md",
"start_line": 2,
"end_line": 2,
"start_column": 5,
"end_column": 10,
"annotation_level": "failure",
"title": "Failure test",
"message": "Failure test message",
"raw_details": "Failure test details",
"blob_href": "https://api.github.com/repos/github/rest-api-description/git/blobs/abc"
},
{
"path": "README.md",
"start_line": 2,
"end_line": 2,
"start_column": 5,
"end_column": 10,
"annotation_level": "notice",
"title": "Notice test",
"message": "Notice test message",
"raw_details": "Notice test details",
"blob_href": "https://api.github.com/repos/github/rest-api-description/git/blobs/abc"
}
]
```### result_path
結果のファイルパス例:
```json
[
{
"job": {
"id": 1511906976,
"run_id": 406257557,
"status": "completed",
"conclusion": "success",
"name": "ESLint"
},
"annotations": [
{
"path": "README.md",
"start_line": 2,
"end_line": 2,
"start_column": 5,
"end_column": 10,
"annotation_level": "warning",
"title": "Warning test",
"message": "Warning test message",
"raw_details": "Warning test details",
"blob_href": "https://api.github.com/repos/github/rest-api-description/git/blobs/abc"
},
{
"path": "README.md",
"start_line": 2,
"end_line": 2,
"start_column": 5,
"end_column": 10,
"annotation_level": "failure",
"title": "Failure test",
"message": "Failure test message",
"raw_details": "Failure test details",
"blob_href": "https://api.github.com/repos/github/rest-api-description/git/blobs/abc"
}
]
},
{
"job": {
"id": 1511909554,
"run_id": 406257557,
"status": "completed",
"conclusion": "success",
"name": "Jest"
},
"annotations": [
{
"path": "README.md",
"start_line": 2,
"end_line": 2,
"start_column": 5,
"end_column": 10,
"annotation_level": "notice",
"title": "Notice test",
"message": "Notice test message",
"raw_details": "Notice test details",
"blob_href": "https://api.github.com/repos/github/rest-api-description/git/blobs/abc"
}
]
}
]
```## Author
[GitHub (Technote)](https://github.com/technote-space)
[Blog](https://technote.space)