Skip to content

Commit

Permalink
GitHub Action: bind mount /usr/bin/gh into the containers
Browse files Browse the repository at this point in the history
We use the `gh` GitHub command line tool to create pull requests.
The tool is installed inside the Tumbleweed container using `zypper`
as usually.

The problem is that the installation might fail in some cases
(GPG key problem, network error,...) and this fails whole action.

But we actually do not need to install the tool, it already is pre-installed in
the default Ubuntu host system. And because the `gh` tool is a statically
linked binary without any dependencies we can simply just bind mount it from
the host inside the container without any installation.
  • Loading branch information
lslezak committed Apr 23, 2024
1 parent d4f44b8 commit f04d0e4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/weblate-merge-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ jobs:

container:
image: registry.opensuse.org/opensuse/tumbleweed:latest
volumes:
# bind mount the GitHub CLI tool from the Ubuntu host,
# it is a statically linked binary so it should work also in TumbleWeed
- /usr/bin/gh:/usr/bin/gh

steps:
- name: Configure and refresh repositories
run: |
# install the GitHub command line tool "gh"
zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo
# disable unused repositories to have a faster refresh
zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && \
zypper --non-interactive --gpg-auto-import-keys ref
zypper --non-interactive ref
- name: Install tools
run: zypper --non-interactive install --no-recommends gh git gettext-tools python3-langtable
run: zypper --non-interactive install --no-recommends git gettext-tools python3-langtable

- name: Configure Git
run: |
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/weblate-merge-products-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ jobs:

container:
image: registry.opensuse.org/opensuse/tumbleweed:latest
volumes:
# bind mount the GitHub CLI tool from the Ubuntu host,
# it is a statically linked binary so it should work also in TumbleWeed
- /usr/bin/gh:/usr/bin/gh

steps:
- name: Configure and refresh repositories
run: |
# install the GitHub command line tool "gh"
zypper addrepo https://cli.github.com/packages/rpm/gh-cli.repo
# disable unused repositories to have a faster refresh
zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && \
zypper --non-interactive --gpg-auto-import-keys ref
zypper --non-interactive ref
- name: Install tools
run: zypper --non-interactive install --no-recommends gh git gettext-tools npm-default
run: zypper --non-interactive install --no-recommends git gettext-tools npm-default

- name: Configure Git
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/weblate-merge-service-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
image: registry.opensuse.org/opensuse/tumbleweed:latest
volumes:
# bind mount the GitHub CLI tool from the Ubuntu host,
# it is a statically linked binary so it should work everywhere
# it is a statically linked binary so it should work also in TumbleWeed
- /usr/bin/gh:/usr/bin/gh

steps:
- name: Configure and refresh repositories
run: |
# disable unused repositories to have a faster refresh
zypper modifyrepo -d repo-non-oss repo-openh264 repo-update && \
zypper --non-interactive --gpg-auto-import-keys ref
zypper --non-interactive ref
- name: Install tools
run: zypper --non-interactive install --no-recommends git gettext-tools
Expand Down

0 comments on commit f04d0e4

Please sign in to comment.