Discord invite is invalid #944
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: Commit po4a changes | |
on: | |
issue_comment: | |
types: [created] | |
permissions: | |
contents: write | |
issues: read | |
pull-requests: write | |
id-token: write | |
statuses: write | |
env: | |
PO4A_VERSION: "0.73" | |
PO4A_GH_URL: https://github.com/mquinson/po4a/releases/download | |
jobs: | |
commit-comment: | |
name: Get po4a check comment | |
if: (github.event.issue.pull_request && startsWith(github.event.comment.body, 'po4a commit')) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: xt0rted/pull-request-comment-branch@v2 | |
id: comment-branch | |
- name: Set up repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.comment-branch.outputs.head_ref }} | |
- name: Check if user has write access | |
id: write_access | |
uses: prince-chrismc/check-actor-permissions-action@v3 | |
with: | |
permission: write | |
- name: Install po4a | |
run: | | |
sudo apt-get install -y po4a # required as standalone po4a is missing some deps | |
wget --quiet ${{ env.PO4A_GH_URL }}/v${{ env.PO4A_VERSION }}/po4a-${{ env.PO4A_VERSION}}.tar.gz # sadly the version from apt isn't working | |
export PO4A_DIR="po4a-${{ env.PO4A_VERSION }}" | |
tar -xf ${PO4A_DIR}.tar.gz | |
- name: Run po4a | |
run: | | |
export PO4A_DIR="po4a-${{ env.PO4A_VERSION }}" | |
export PERL5LIB="${PO4A_DIR}/lib:${PERL5LIB}" | |
./${PO4A_DIR}/po4a --no-translations po4a.cfg | |
- name: Check git changes | |
run: git status --porcelain translations > files.txt | |
- name: Add comment | |
run: | | |
if [[ -s files.txt ]]; then | |
# There are edited files | |
git config --global user.email "[email protected]" | |
git config --global user.name "github-actions" | |
git add translations | |
git commit -m "[Automatic] Add po4a updates" | |
git push | |
echo 'Changes committed successfully 🎉 Please update your local branch by running `git pull` 💻' >> body.txt | |
echo 'Bear in mind that I am a bot 🤖 so I cannot trigger workflows!' >> body.txt | |
echo 'Trigger them by pushing an empty commit: `git commit --allow-empty -m "Trigger workflows" && git push`.' >> body.txt | |
else | |
echo 'Nothing to commit, `po4a` run was clean ✨' >> body.txt | |
fi | |
gh pr comment ${{ steps.comment-branch.outputs.head_ref }} --body-file body.txt | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Comment about non-membership status | |
if: ${{ failure() && steps.write_access.conclusion == 'failure' }} | |
run: | | |
gh pr comment ${{ steps.comment-branch.outputs.head_ref }} --body "⛔ Sorry, only members with write access are allowed to run this action!" | |
env: | |
GH_TOKEN: ${{ github.token }} |