Argus is a bot built with Probot to watch for repository's workflows with tests, download artifacts with screenshots differences images, and pin these images to bot's comment of pull request.
Why "Argus"? Argus is a many-eyed "all-seeing" giant in Greek mythology. This character is known for having generated the saying "the eyes of Argus" (being subject to strict scrutiny in one's actions to an invasive, distressing degree). (c) Wikipedia
Read more about this tool:
- «Bots should work, developers should think»: Writing Github App with Node.js (English)
- «Боты должны работать, разработчики должны думать»: пишем Github App на Node.js (Russian)
GitHub Action is recommended approach to use bot.
However, its deployment as GitHub App is option too.
# .github/workflows/screenshot-bot.yml
on:
workflow_run:
workflows: [E2E Results] # <-- Choose any workflows to be watched by bot
types: [requested, completed]
branches-ignore:
- 'main'
- 'release/**'
pull_request:
types: [closed]
jobs:
awake-screenshot-bot:
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
pull-requests: write
steps:
- uses: taiga-family/argus
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
You can deploy your own Github App using this code and recipes from Probot documentation.
After deployment:
- Invite bot to you repo.
- See its configurable params or use default ones.
Bot has configurable params which can be unique for every Github repository.
Every param is optional, and you can skip this section if default configuration satisfies you.
To pass custom params for bot you should create screenshot-bot.config.yml
file inside the .github
directory of repository.
Example of screenshot-bot.config.yml
file content (you can paste it as it is) and default values of each param:
# array of RegExp strings to match images inside artifacts (by their path or file name)
# which shows difference between two screenshot and which will be added to bot report comment
diff-paths: [
# it is default Cypress folder name into which snapshot diffs are put
'.*__diff_output__.*',
]
# array of attributes (key="value") for html-tag <img /> (screenshots)
# e.g. ['width="200px"', 'height="300px"']
img-attrs: []
# Text which is placed at the beginning of section "Failed tests"
failed-report-description: ''
# Regular expression string to match images inside artifacts (by their path or file name)
# which are created by new screenshot tests.
new-screenshot-mark: '.*==new==.*'
##################################
# Not relevant for GitHub Action #
##################################
# array of regular expression strings to match workflow names
# which should be watched by bot
workflows: [
# all workflows with sub-string "screenshot" in their names
'.*screenshot.*',
]
# array of RegExp strings to match branch names which should be skipped by bot
branches-ignore: []
- Holds first PR comment. All workflow updates edit already existing bot comment. No endless stream of comments from bot!
- Sets loading state comment when PR is opened or new commits are pushed to PR.
- Downloads artifacts from workflow with tests, finds screenshots diffs images, and pins them to the tests failure report.
- Removes all uploaded images (for current PR) after closing pull request.
If you use bot as GitHub Action it is required to provide permissions
property in your yml
file.
If you use bot as GitHub App it asks for some permissions at the beginning of the bot's installation.
All requested permissions are really needed, and we do not ask for more permissions than necessary.
Bot requires the following repository's permissions:
actions: read
- to get list of workflow run artifacts and download these artifacts.contents: write
- to create new branch for storage of screenshot diffs images and to ability to upload/delete these screenshot diffs images.metadata: read
- mandatory for Github App.pull_requests: write
- to create/edit PR's comment with bot's tests reports.
Bot listens to the following repository's events:
pull_request
— bot listens to pull request closing to delete all saved screenshots for current closed PR.workflow_run
— bot listens to workflow completion to download artifacts and send tests report as PR comment.
If you have suggestions for how bot could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
For more, check out the Contributing Guide.
🆓 Feel free to use our bot in your commercial and private applications.
Bot is covered by Apache 2.0.
Read more about this license here.