Skip to content

Commit df00508

Browse files
committed
feat: Add queensac action for GitHub repository link checks
Introduce a new GitHub Action named "queensac" that checks repository links and optionally opens pull requests to fix them. The action includes configurable inputs for repository URL, target branch, dry-run mode, and GitHub App credentials. Additionally, update environment variable references in the code to align with the new action's naming conventions.
1 parent 31b9cc9 commit df00508

File tree

3 files changed

+63
-6
lines changed

3 files changed

+63
-6
lines changed

action.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: "queensac"
2+
description: "Check GitHub repository links and optionally open PRs to fix them."
3+
author: "reddevilmidzy"
4+
branding:
5+
icon: "link"
6+
color: "purple"
7+
inputs:
8+
repo:
9+
description: "GitHub repository URL to scan (defaults to the workflow repository)."
10+
required: false
11+
branch:
12+
description: "Target branch to check and base branch for the pull request."
13+
required: false
14+
dry-run:
15+
description: "Skip pull request creation and only report results."
16+
default: "false"
17+
required: false
18+
github_app_id:
19+
description: "GitHub App ID to use when creating pull requests."
20+
required: false
21+
github_app_private_key:
22+
description: "GitHub App private key (PEM) to use when creating pull requests."
23+
required: false
24+
runs:
25+
using: "composite"
26+
steps:
27+
- name: Install queensac
28+
shell: bash
29+
run: |
30+
set -eo pipefail
31+
rustup update stable
32+
cargo install --path "${{ github.action_path }}" --force
33+
echo "${HOME}/.cargo/bin" >> "${GITHUB_PATH}"
34+
- name: Run queensac
35+
shell: bash
36+
env:
37+
QUEENSAC_APP_ID: ${{ inputs.github_app_id }}
38+
QUEENSAC_APP_PRIVATE_KEY: ${{ inputs.github_app_private_key }}
39+
run: |
40+
set -eo pipefail
41+
42+
repo_input='${{ inputs.repo }}'
43+
if [ -z "${repo_input}" ]; then
44+
repo_input="https://github.com/${{ github.repository }}"
45+
fi
46+
47+
cmd=(queensac --repo "${repo_input}")
48+
49+
if [ -n "${{ inputs.branch }}" ]; then
50+
cmd+=("--branch" "${{ inputs.branch }}")
51+
fi
52+
53+
if [ "${{ inputs.dry-run }}" = "true" ]; then
54+
cmd+=("--dry-run")
55+
fi
56+
"${cmd[@]}"
57+

src/git/pr_generator.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ impl GitHubAppConfig {
4747
/// Creates a GitHub App configuration from environment variables.
4848
///
4949
/// # Environment Variables
50-
/// * `GITHUB_APP_ID` - The GitHub App ID
51-
/// * `GITHUB_APP_PRIVATE_KEY` - The GitHub App private key (PEM format)
50+
/// * `QUEENSAC_APP_ID` - The GitHub App ID
51+
/// * `QUEENSAC_APP_PRIVATE_KEY` - The GitHub App private key (PEM format)
5252
pub fn from_env() -> Result<Self, PrError> {
53-
let app_id = read_env_var("GITHUB_APP_ID")?
53+
let app_id = read_env_var("QUEENSAC_APP_ID")?
5454
.parse::<u64>()
55-
.map_err(|e| PrError::Config(format!("Invalid GITHUB_APP_ID: {e}")))?;
55+
.map_err(|e| PrError::Config(format!("Invalid QUEENSAC_APP_ID: {e}")))?;
5656

57-
let private_key = read_env_var("GITHUB_APP_PRIVATE_KEY")?;
57+
let private_key = read_env_var("QUEENSAC_APP_PRIVATE_KEY")?;
5858

5959
Ok(Self {
6060
app_id,

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn main() {
6969
}
7070

7171
let app_config = GitHubAppConfig::from_env().unwrap_or_else(|e| {
72-
error!("GitHub App configuration not found: {}. Please set GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY environment variables.", e);
72+
error!("GitHub App configuration not found: {}. Please set QUEENSAC_APP_ID and QUEENSAC_APP_PRIVATE_KEY environment variables.", e);
7373
std::process::exit(1);
7474
});
7575

0 commit comments

Comments
 (0)