Import fenix quarantine #687
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: Linter for reference content | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/reference_linter.yaml" | |
- ".github/scripts/reference_linter.py" | |
- ".github/scripts/linter_config.json" | |
- "**/values/strings.xml" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
linter: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
with: | |
path: src | |
- name: Clone repository (default branch) | |
uses: actions/checkout@v4 | |
with: | |
path: base | |
ref: "${{github.event.pull_request.base.sha}}" | |
- name: Set up Python 3 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install Python dependencies | |
run: | | |
pip install -r src/.github/requirements.txt | |
- name: Lint reference files | |
run: | | |
(cd src && python .github/scripts/reference_linter.py --toml firefox.toml --config .github/scripts/linter_config.json --json ../errors.json) | |
(cd src && python .github/scripts/reference_linter.py --toml focus.toml --config .github/scripts/linter_config.json --json ../errors.json) | |
- name: Check for unchanged IDs | |
run: | | |
python src/.github/scripts/detect_unchanged_ids.py --base base --head src --toml firefox.toml | |
python src/.github/scripts/detect_unchanged_ids.py --base base --head src --toml focus.toml | |
- name: Create comment for pull request | |
# Do not fail if anything goes wrong, e.g. API requests time out | |
continue-on-error: true | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
# It's a pull request, I can use directly the event number | |
pr=${{ github.event.number }} | |
echo "Event triggered by pull request (${pr})." | |
else | |
# Try to find an open pull request which has the current branch as head | |
branch="${GITHUB_REF#refs/heads/}" | |
if [[ "${branch}" != "main" ]];then | |
pr=$(cd src && gh pr list --json number --jq ".[].number" --head $branch) | |
echo "Found existing pull request for ${branch} (${pr})." | |
else | |
pr="none" | |
echo "Push against default branch." | |
fi | |
fi | |
if [[ $pr != "none" ]]; then | |
python src/.github/scripts/comment_errors.py --token ${{ secrets.ANDROID_GITHUB_TOKEN }} --repo ${{ github.event.repository.name }} --owner ${{ github.repository_owner }} --pr $pr --run ${{ github.run_id }} | |
if [ -f "comment.txt" ]; then | |
gh pr comment ${{ github.event.number }} --repo ${{ github.repository }} --body-file comment.txt | |
fi | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.ANDROID_GITHUB_TOKEN }} | |
- name: Output errors | |
run: | | |
if [ -f "errors.json" ]; then | |
python src/.github/scripts/output_errors.py | |
fi | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: errors-list | |
path: errors.* | |
if-no-files-found: ignore | |
- name: Fail on errors | |
run: | | |
if [ -f "errors.txt" ]; then | |
cat errors.txt | |
exit 1 | |
fi |