Created
December 9, 2023 17:36
-
-
Save susan31213-a/2b25a9cbc257d30ebd0e9e6a9357ed49 to your computer and use it in GitHub Desktop.
このコードは Akatsuki Games Advent Calendar 2023 の12日目の記事に入ってるコードです。https://adventar.org/calendars/8724
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: "Check layout translation diff" | |
on: | |
pull_request: | |
jobs: | |
check_layout_translation_diff: | |
name: check_layout_translation_diff | |
runs-on: [ ubuntu-20.04 ] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v40 | |
with: | |
since_last_remote_commit: true # Push前のリモートコミットから今回Pushした内容だけ確認する | |
files: LayoutClass/*.h | |
- name: List all changed files | |
if: steps.changed-files.outputs.any_modified == 'true' | |
run: | | |
echo "All modified LayoutClass header files:" | |
for file in ${{ steps.changed-files.outputs.all_modified_files }}; do | |
echo "$file" | |
done | |
- name: Setup Ruby | |
if: steps.changed-files.outputs.any_modified == 'true' | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
- name: Install doxygen and gems | |
if: steps.changed-files.outputs.any_modified == 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y doxygen | |
gem install nokogiri | |
gem install doxyparser | |
- name: Get layout translation diff | |
if: steps.changed-files.outputs.any_modified == 'true' | |
run: | | |
BASE_SHA=${{ github.event.before }} | |
if [ -z "$BASE_SHA" ]; then | |
BASE_SHA=${{ github.event.pull_request.base.sha }} | |
fi | |
ruby ./layout_string_diff.rb $BASE_SHA ${{ github.sha }} --no-status-message > layout_string_diff.txt | |
cat layout_string_diff.txt | |
- name: Add GitHub CLI official repo | |
shell: bash | |
# 参考: https://github.com/cli/cli/issues/6175#issuecomment-1244334928 | |
env: | |
PACKAGE_REPO: https://cli.github.com/packages | |
KEYRING: githubcli-archive-keyring.gpg | |
KEYRINGS_DIR: /etc/apt/trusted.gpg.d | |
run: | | |
curl -fsSL ${PACKAGE_REPO}/${KEYRING} | sudo dd of=${KEYRINGS_DIR}/${KEYRING} | |
sudo chmod go+r ${KEYRINGS_DIR}/${KEYRING} | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=${KEYRINGS_DIR}/${KEYRING}] ${PACKAGE_REPO} stable main" \ | |
| sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | |
- name: Install GitHub CLI | |
shell: bash | |
run: | | |
sudo apt update | |
sudo apt install -y gh | |
- name: Comment on pull request | |
if: steps.changed-files.outputs.any_modified == 'true' | |
env: | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
run: | | |
echo '${{ secrets.GITHUB_TOKEN }}' | gh auth login --with-token | |
gh pr comment ${{ github.event.number }} --repo ${OWNER}/${REPO} -F ./layout_string_diff.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment