Apply the language URL parameter to the whole interface #21785
This file contains hidden or 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: Build Tracker JS files | |
| on: | |
| issue_comment: | |
| types: [created] | |
| permissions: | |
| actions: read | |
| checks: none | |
| contents: write | |
| deployments: none | |
| issues: read | |
| packages: none | |
| pull-requests: write | |
| repository-projects: none | |
| security-events: none | |
| statuses: none | |
| jobs: | |
| build: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Detect branch for PR | |
| id: vars | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| PR=$( echo "${{ github.event.comment.issue_url }}" | grep -oE 'issues/([0-9]+)$' | cut -d'/' -f 2 ) | |
| PR_INFO=$( curl \ | |
| --request GET \ | |
| --header "authorization: Bearer ${GITHUB_TOKEN}" \ | |
| --header 'content-type: application/json' \ | |
| --url "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/$PR" ) | |
| REF=$(echo "${PR_INFO}" | jq -r .head.ref) | |
| BASE=$(echo "${PR_INFO}" | jq -r .head.repo.full_name) | |
| STATE=$(echo "${PR_INFO}" | jq -r .state) | |
| if [[ $STATE == "closed" ]] | |
| then | |
| echo "Pull Request already closed." | |
| exit 0; | |
| fi | |
| if [[ "$BASE" != "$GITHUB_REPOSITORY" ]] | |
| then | |
| echo "It's only possible to update local branches" | |
| exit 0; | |
| fi | |
| echo "branch=$REF" >> "$GITHUB_OUTPUT" | |
| if: github.event.comment.body == 'build js' | |
| - uses: actions/setup-java@v6 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '9' | |
| if: steps.vars.outputs.branch != '' | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ steps.vars.outputs.branch }} | |
| lfs: false | |
| persist-credentials: false | |
| if: steps.vars.outputs.branch != '' | |
| - name: Prepare git config | |
| run: | | |
| git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| git config --global user.name "$GITHUB_ACTOR" | |
| if: steps.vars.outputs.branch != '' | |
| - name: Fetch YUICompressor | |
| run: | | |
| cd "$GITHUB_WORKSPACE/js" | |
| wget https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.zip | |
| sha512sum -c "$GITHUB_WORKSPACE/.github/checksums/yuicompressor-2.4.8.zip.sha512" | |
| unzip yuicompressor-2.4.8.zip | |
| if: steps.vars.outputs.branch != '' | |
| - name: Build JS files | |
| run: | | |
| cd "$GITHUB_WORKSPACE/js" | |
| sed '/<DEBUG>/,/<\/DEBUG>/d' < piwik.js | sed 's/eval/replacedEvilString/' | java -jar yuicompressor-2.4.8.jar --type js --line-break 1000 | sed 's/replacedEvilString/eval/' | sed 's/^[/][*]/\/*!/' > piwik.min.js && cp piwik.min.js ../piwik.js && cp piwik.min.js ../matomo.js | |
| if: steps.vars.outputs.branch != '' | |
| - name: Push changes | |
| run: | | |
| if [[ $( git diff --numstat ) ]] | |
| then | |
| cd "$GITHUB_WORKSPACE" | |
| git add piwik.js matomo.js js/piwik.min.js | |
| git commit -m "Build tracker JS files" | |
| git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}" "HEAD:${BRANCH_NAME}" | |
| fi | |
| env: | |
| BRANCH_NAME: ${{ steps.vars.outputs.branch }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| if: steps.vars.outputs.branch != '' |