Skip to content

Commit 3fc281e

Browse files
committed
Add workflow to rebuild the Action on a label
1 parent edb8265 commit 3fc281e

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/rebuild.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Rebuild Action
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
rebuild:
9+
name: Rebuild Action
10+
runs-on: ubuntu-latest
11+
if: github.event.label.name == 'Rebuild'
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Remove label
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
PR_NUMBER: ${{ github.event.pull_request.number }}
21+
run: |
22+
gh pr edit --repo github/codeql-action "$PR_NUMBER" \
23+
--remove-label "Rebuild"
24+
25+
- name: Compile TypeScript
26+
run: |
27+
npm install
28+
npm run lint -- --fix
29+
npm run build
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: 3.11
35+
36+
- name: Generate workflows
37+
run: |
38+
cd pr-checks
39+
python -m pip install --upgrade pip
40+
pip install ruamel.yaml==0.17.31
41+
python3 sync.py
42+
43+
- name: Check for changes and push
44+
env:
45+
BRANCH: ${{ github.event.pull_request.head.ref }}
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
PR_NUMBER: ${{ github.event.pull_request.number }}
48+
run: |
49+
if [ ! -z "$(git status --porcelain)" ]; then
50+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
51+
git config --global user.name "github-actions[bot]"
52+
git commit -am "Rebuild"
53+
git push origin "HEAD:$BRANCH"
54+
echo "Pushed a commit to rebuild the Action." \
55+
"Please mark the PR as ready for review to trigger PR checks." |
56+
gh pr comment --body-file - --repo github/codeql-action "$PR_NUMBER"
57+
gh pr ready --undo --repo github/codeql-action "$PR_NUMBER"
58+
fi

0 commit comments

Comments
 (0)