-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
73 lines (64 loc) · 2.16 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: pkgcruft
description: Scan a Gentoo ebuild repository using pkgcruft.
branding:
color: "purple"
icon: "package"
inputs:
repo:
description: Path to ebuild repo
required: false
default: './'
pr-comments:
description: Enable pull request comment support
required: false
default: 'true'
git:
description: Use pkgcraft from git
required: false
default: 'false'
runs:
using: composite
steps:
- uses: cargo-bins/cargo-binstall@main
- name: Install pkgcraft tools
id: install
shell: bash
run: |
if [[ ${{ inputs.git }} == "true" ]]; then
cargo install pkgcruft --git https://github.com/pkgcraft/pkgcraft.git
else
cargo binstall --target x86_64-unknown-linux-gnu pkgcruft
fi
pkgcruft --version
echo "pkgcruft=$(pkgcruft --version)" >> $GITHUB_OUTPUT
- name: Restore cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: ~/.cache/pkgcruft
key: ${{ github.ref_name }}-${{ steps.install.outputs.pkgcruft }}-repo-${{ hashFiles(format('{0}/**/*', inputs.repo)) }}
restore-keys: |
${{ github.ref_name }}-
${{ github.event.repository.default_branch }}-
- name: Set environment
shell: bash
run: |
echo "REPO=${{ inputs.repo }}" >> $GITHUB_ENV
echo "PR_COMMENTS=${{ inputs.pr-comments }}" >> $GITHUB_ENV
echo "GIT_DEFAULT_BRANCH=${{ github.event.repository.default_branch }}" >> $GITHUB_ENV
echo "GH_PR=${{ github.event.number }}" >> $GITHUB_ENV
echo "GIT_BASE_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
echo "GIT_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
# add action path to $PATH
echo "${{ github.action_path }}" >> $GITHUB_PATH
- name: Run pkgcruft action
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: pkgcruft-action
- name: Save cache
if: ${{ github.base_ref == '' && steps.restore-cache.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ~/.cache/pkgcruft
key: ${{ steps.restore-cache.outputs.cache-primary-key }}