hall voice #782
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: Sanitize | |
on: | |
pull_request_target: | |
branches: [ master ] | |
paths: | |
- 'custom/*.json' | |
- 'mp3/**' | |
- '**.mp3' | |
workflow_dispatch: | |
jobs: | |
sanitize: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} # Force get PR's files | |
- name: Install sox, jq and pip packages | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -qq -y install libsox-fmt-mp3 sox jq | |
python3 -m pip install -r requirements.txt | |
- name: Get changed files | |
#uses: lots0logs/[email protected] | |
uses: Mineflash07/gh-action-get-changed-files@feature/support-pr-target-event # Remove as soon as PR is merged. See https://github.com/lots0logs/gh-action-get-changed-files/pull/22 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Run sanitize.py | |
# run: jq -r '.[]' ${HOME}/files.json | xargs python3 sanitize.py -v -- | |
# - name: Commit changes | |
# uses: stefanzweifel/git-auto-commit-action@v4 | |
# with: | |
# commit_message: 'CI: Sanitize mp3' | |
# commit_author: 'GitHub Actions <[email protected]>' | |
# - name: Post comment for sanitize | |
# uses: actions/github-script@v3 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# script: | | |
# github.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: 'CI: mp3 files have been sanitized 🔉' | |
# }) | |
- name: Check if .json file is present | |
id: check-json | |
continue-on-error: true | |
run: jq -r '[.[] | select(startswith("custom") or startswith("mp3")) | split("/")[1] | split(".json")[0]] | unique[]' ${HOME}/files.json | xargs -I % test -f "custom/%.json" | |
- name: Post comment for .json missing | |
if: steps.check-json.outcome != 'success' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'CI: .json file is missing ❌' | |
}) | |
core.setFailed('.json file is missing') | |
- name: Check if student has bought Hall Voice Change on intra | |
id: check-commands | |
env: | |
API42_ID: ${{ secrets.API42_ID }} | |
API42_SECRET: ${{ secrets.API42_SECRET }} | |
continue-on-error: true | |
run: jq -r '[.[] | select(startswith("custom") or startswith("mp3")) | split("/")[1] | split(".json")[0]] | unique[]' ${HOME}/files.json | xargs python3 check-commands.py -v -- | |
- name: Post comment for check-commands (OK) | |
if: steps.check-commands.outcome == 'success' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'CI: HallVoice check on intra shop: OK ✅' | |
}) | |
- name: Post comment for check-commands (KO) | |
if: steps.check-commands.outcome != 'success' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'CI: HallVoice check on intra shop: KO ❌' | |
}) | |
core.setFailed('HallVoice check on intra shop KO') |