Skip to content

Commit 9a4f7df

Browse files
feat: Onboard winterjung/comment action
Signed-off-by: Anurag Rajawat <anurag@stepsecurity.io>
1 parent 55f67e8 commit 9a4f7df

File tree

13 files changed

+704
-1
lines changed

13 files changed

+704
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release GitHub Actions
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag for the release"
8+
required: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
release:
15+
permissions:
16+
actions: read
17+
id-token: write
18+
contents: write
19+
20+
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
21+
with:
22+
tag: "${{ github.event.inputs.tag }}"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Auto Cherry-Pick from Upstream
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
base_branch:
7+
description: "Base branch to create the PR against"
8+
required: true
9+
default: "main"
10+
mode:
11+
description: "Run mode: cherry-pick or verify"
12+
required: false
13+
default: "cherry-pick"
14+
15+
pull_request:
16+
types: [opened, synchronize, labeled]
17+
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
packages: read
22+
issues: write
23+
24+
jobs:
25+
cherry-pick:
26+
if: github.event_name == 'workflow_dispatch' || contains(fromJson(toJson(github.event.pull_request.labels)).*.name, 'review-required')
27+
uses: step-security/reusable-workflows/.github/workflows/auto_cherry_pick.yaml@v1
28+
with:
29+
original-owner: "winterjung"
30+
repo-name: "comment"
31+
base_branch: ${{ inputs.base_branch }}
32+
mode: ${{ github.event_name == 'pull_request' && 'verify' || inputs.mode }}

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: ci
2+
3+
on:
4+
- push
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v6
12+
13+
- name: Build
14+
run: docker build -t build-test .
15+
16+
integration:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v6
21+
22+
- name: Create comment
23+
id: create
24+
run: |
25+
python3 main.py
26+
env:
27+
INPUT_TYPE: create
28+
INPUT_BODY: "- [ ] Run tests"
29+
INPUT_ISSUE_NUMBER: "1"
30+
INPUT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Update comment
33+
id: edit
34+
run: |
35+
python3 main.py
36+
env:
37+
INPUT_TYPE: edit
38+
INPUT_BODY: "- [x] Run tests"
39+
INPUT_COMMENT_ID: "${{ steps.create.outputs.id }}"
40+
INPUT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Test create and edit
43+
env:
44+
CREATE_ID: ${{ steps.create.outputs.id }}
45+
EDIT_ID: ${{ steps.edit.outputs.id }}
46+
EDIT_BODY: ${{ steps.edit.outputs.body }}
47+
run: |
48+
[[ "$CREATE_ID" == "$EDIT_ID" ]] || exit 1
49+
[[ "$EDIT_BODY" == "- [x] Run tests" ]] || exit 1
50+
51+
- name: Delete comment
52+
id: delete
53+
run: |
54+
python3 main.py
55+
env:
56+
INPUT_TYPE: delete
57+
INPUT_COMMENT_ID: "${{ steps.edit.outputs.id }}"
58+
INPUT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Test delete
61+
env:
62+
DELETE_ID: ${{ steps.delete.outputs.id }}
63+
run: |
64+
[[ "$DELETE_ID" == "" ]] || exit 1

.github/workflows/docker.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish docker image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'Tag to release'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: read
13+
packages: write
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
if: startsWith(github.event.inputs.release_tag, 'v')
19+
steps:
20+
- name: Harden the runner (Audit all outbound calls)
21+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
22+
with:
23+
egress-policy: audit
24+
25+
- name: Checkout
26+
uses: actions/checkout@v6
27+
- name: Validate tag format
28+
run: |
29+
TAG=${{ github.event.inputs.release_tag }}
30+
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
31+
echo "❌ Invalid tag format: $TAG"
32+
exit 1
33+
fi
34+
echo "✅ Valid semver tag: $TAG"
35+
- name: Log in to GitHub Container Registry
36+
uses: step-security/docker-login-action@v3
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Set up QEMU for ARM builds
43+
uses: step-security/setup-qemu-action@v3
44+
45+
- name: Set up Docker Buildx
46+
uses: step-security/setup-buildx-action@v4
47+
48+
- name: Build and push Docker image
49+
uses: step-security/docker-build-push-action@v6
50+
with:
51+
context: .
52+
push: true
53+
platforms: linux/amd64,linux/arm64
54+
tags: |
55+
ghcr.io/${{ github.repository }}:${{ github.event.inputs.release_tag }}

.github/workflows/guarddog.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Run GuardDog Scan on PRs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
call-guarddog-scan:
14+
uses: step-security/reusable-workflows/.github/workflows/guarddog.yml@v1

0 commit comments

Comments
 (0)