@liblaf/actions 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,60 @@
1
+ # yaml-language-server: $schema=https://json.schemastore.org/github-action.json
2
+
3
+ name: Install
4
+
5
+ author: liblaf
6
+
7
+ description: Install
8
+
9
+ inputs:
10
+ apt:
11
+ description: apt
12
+ required: false
13
+ brew:
14
+ description: brew
15
+ required: false
16
+ choco:
17
+ description: choco
18
+ required: false
19
+ token:
20
+ description: GitHub Token
21
+ required: false
22
+ default: ${{ github.token }}
23
+
24
+ runs:
25
+ using: composite
26
+ steps:
27
+ - if: runner.os == 'Linux' && inputs.apt
28
+ name: apt
29
+ run: |-
30
+ read -a packages -r <<< "$INPUT_APT"
31
+ sudo apt-get update
32
+ sudo apt-get install "${packages[@]}"
33
+ shell: bash
34
+ env:
35
+ INPUT_APT: ${{ inputs.apt }}
36
+ - if: runner.os == 'macOS' && inputs.brew
37
+ name: brew
38
+ run: |-
39
+ read -a packages -r <<< "$INPUT_BREW"
40
+ brew update
41
+ brew install "${packages[@]}"
42
+ for pkg in "${packages[@]}"; do
43
+ case "$pkg" in
44
+ coreutils | make | gnu-*)
45
+ gnubin="$(brew --prefix)/opt/$pkg/libexec/gnubin"
46
+ echo "$gnubin" >> "$GITHUB_PATH"
47
+ ;;
48
+ esac
49
+ done
50
+ shell: bash
51
+ env:
52
+ INPUT_BREW: ${{ inputs.brew }}
53
+ - if: runner.os == 'Windows' && inputs.choco
54
+ name: choco
55
+ run: |-
56
+ read -a packages -r <<< "$INPUT_CHOCO"
57
+ choco install "${packages[@]}"
58
+ shell: bash
59
+ env:
60
+ INPUT_CHOCO: ${{ inputs.choco }}
@@ -0,0 +1,65 @@
1
+ # yaml-language-server: $schema=https://json.schemastore.org/github-action.json
2
+ # ref: <https://github.com/oxsecurity/megalinter/blob/main/mega-linter-runner/generators/mega-linter/templates/mega-linter.yml>
3
+ # ref: <https://megalinter.io>
4
+
5
+ name: MegaLinter
6
+
7
+ author: liblaf
8
+
9
+ description: MegaLinter
10
+
11
+ inputs:
12
+ token:
13
+ description: GitHub Token
14
+ required: true
15
+ default: ${{ github.token }}
16
+
17
+ # Reporters
18
+ github-status-reporter:
19
+ description: GitHub Status Reporter
20
+ required: true
21
+ default: "false"
22
+ markdown-summary-reporter:
23
+ description: Markdown Summary Reporter
24
+ required: true
25
+ default: "true"
26
+
27
+ outputs:
28
+ has-updated-sources:
29
+ description: 0 if no source file has been updated, 1 if source files has been updated
30
+ value: ${{ steps.lint.outputs.has_updated_sources }}
31
+
32
+ runs:
33
+ using: composite
34
+ steps:
35
+ - name: Checkout Linter Rules
36
+ uses: actions/checkout@v5
37
+ with:
38
+ repository: ${{ github.repository_owner }}/.github
39
+ token: ${{ inputs.token }}
40
+ path: tmp.6NE8UxMvCk
41
+ sparse-checkout: linters
42
+ - name: Pre
43
+ run: bash '${{ github.action_path }}/pre.sh'
44
+ shell: bash
45
+ - id: lint
46
+ name: MegaLinter
47
+ uses: liblaf/megalinter-custom-flavor-all@main
48
+ env:
49
+ GITHUB_TOKEN: ${{ inputs.token }}
50
+ # ref: <https://megalinter.io/latest/config-variables/>
51
+ # Reporters
52
+ GITHUB_STATUS_REPORTER: ${{ inputs.github-status-reporter }}
53
+ MARKDOWN_SUMMARY_REPORTER: ${{ inputs.markdown-summary-reporter }}
54
+ - if: success() || failure()
55
+ name: Post
56
+ run: bash '${{ github.action_path }}/post.sh'
57
+ shell: bash
58
+ - if: success() || failure()
59
+ name: Clean Linter Rules
60
+ run: sudo rm --force --recursive 'tmp.6NE8UxMvCk'
61
+ shell: bash
62
+ - if: success() || failure()
63
+ name: Prepare Commit
64
+ run: sudo chown --changes --recursive "$UID" '.git/'
65
+ shell: bash
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ set -o errexit
3
+ set -o nounset
4
+ set -o pipefail
5
+
6
+ while read -r filename; do
7
+ rm --force --verbose "$filename"
8
+ done < "$RUNNER_TEMP/missing-linter-files.list"
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+ set -o errexit
3
+ set -o nounset
4
+ set -o pipefail
5
+
6
+ LINTER_RULES_PATH='tmp.6NE8UxMvCk/linters'
7
+
8
+ MISSING_FILES=()
9
+ while IFS= read -d '' -r file; do
10
+ filename="$(basename -- "$file")"
11
+ if [[ -f $filename ]]; then continue; fi
12
+ cp --archive --no-target-directory --verbose "$file" "$filename"
13
+ MISSING_FILES+=("$filename")
14
+ done < <(find "$LINTER_RULES_PATH" -type f -print0)
15
+
16
+ printf '%s\n' "${MISSING_FILES[@]}" > "$RUNNER_TEMP/missing-linter-files.list"
@@ -0,0 +1,38 @@
1
+ # yaml-language-server: $schema=https://www.schemastore.org/github-action.json
2
+
3
+ name: PR Label
4
+
5
+ author: liblaf
6
+
7
+ description: PR Label
8
+
9
+ inputs:
10
+ add-labels:
11
+ description: Labels to add to the pull request.
12
+ required: true
13
+ authors:
14
+ description: authors
15
+ required: false
16
+ bot:
17
+ description: bot
18
+ required: false
19
+ default: "true"
20
+ labels:
21
+ description: labels
22
+ required: false
23
+ pull-number:
24
+ description: The pull request number to approve.
25
+ required: false
26
+ default: ${{ github.event.pull_request.number }}
27
+ repository:
28
+ description: The owner and repository name. For example, `octocat/Hello-World`.
29
+ required: false
30
+ default: ${{ github.repository }}
31
+ token:
32
+ description: token
33
+ required: false
34
+ default: ${{ github.token }}
35
+
36
+ runs:
37
+ using: node24
38
+ main: src/index.js