fix(Button): Remove non necessary catalog example #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Record screenshots on PR comment | |
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
record-screenshots: | |
name: Record screenshots | |
# Only if it is a PR and the comment contains /record-screenshots | |
if: github.event.issue.pull_request && contains(github.event.comment.body, '/record-screenshots') | |
runs-on: self-hosted-novum-mac | |
steps: | |
- name: Update the comment on PR with link to the job | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const name = '${{ github.workflow }}'; | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const body = `${name} launched: ${url}`; | |
await github.rest.issues.updateComment({ | |
comment_id: context.payload.comment.id, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) | |
- name: Get branch of PR | |
uses: xt0rted/pull-request-comment-branch@v2 | |
id: comment-branch | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.comment-branch.outputs.head_sha }} | |
- name: Enable screenshots recording | |
run: | | |
find . -type f -name "*.swift" -exec sed -i '' 's/isRecording = false/isRecording = true/' {} + | |
- name: Launch tests and record screenshots | |
run: make test | |
continue-on-error: true | |
- name: Disable screenshots recording | |
run: | | |
find . -type f -name "*.swift" -exec sed -i '' 's/isRecording = true/isRecording = false/' {} + | |
- name: Commit Changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
id: commit-changes | |
with: | |
branch: ${{ steps.comment-branch.outputs.head_ref }} | |
file_pattern: '*.png' | |
commit_message: Record screenshots automatically launched from GH action | |
env: | |
GITHUB_TOKEN: ${{ secrets.NOVUM_PRIVATE_REPOS }} | |
outputs: | |
commit_hash: ${{ steps.commit-changes.outputs.commit_hash }} | |
execute-tests: | |
name: Execute tests | |
needs: record-screenshots | |
uses: ./.github/workflows/ci.yml | |
secrets: inherit | |
with: | |
ref: ${{ needs.record-screenshots.outputs.commit_hash }} | |
set-commit-status: | |
name: Set last commit status | |
if: always() && needs.record-screenshots.result != 'skipped' | |
needs: [record-screenshots, execute-tests] | |
runs-on: self-hosted-novum-mac | |
steps: | |
- uses: myrotvorets/set-commit-status-action@master | |
with: | |
sha: ${{ needs.record-screenshots.outputs.commit_hash }} | |
token: ${{ secrets.NOVUM_PRIVATE_REPOS }} | |
status: ${{ needs.execute-tests.result }} | |
comment-result-on-pr: | |
name: Add workflow result on PR by updating the comment that triggered the workflow | |
needs: record-screenshots | |
if: always() && needs.record-screenshots.result != 'skipped' | |
runs-on: self-hosted-novum-mac | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
const name = '${{ github.workflow }}'; | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const success = '${{ needs.record-screenshots.result }}' === 'success'; | |
const body = `${name}: ${success ? 'succeeded ✅' : 'failed ❌'}\n${url}`; | |
await github.rest.issues.updateComment({ | |
comment_id: context.payload.comment.id, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) |