Feature request #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Share regex/workflow on wiki | |
on: | |
issues: | |
types: [opened, edited, deleted] | |
permissions: | |
contents: write | |
jobs: | |
collect-issues: | |
if: github.event.action == 'deleted' || contains(github.event.issue.labels.*.name, 'share regex/workflow') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Install Dependencies | |
run: npm install @actions/core @actions/github | |
- name: Run Collection Script | |
id: collect | |
run: node .github/workflows/share.js | |
env: | |
GITHUB_TOKEN: ${{ secrets.SYNC_TOKEN }} | |
- name: Log Results | |
run: echo "${{ steps.collect.outputs.result }}" | |
- name: Upload result | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated.md | |
path: generated.md | |
- name: Checkout wiki | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{github.repository}}.wiki | |
path: wiki_dir | |
- name: Modify wiki | |
env: | |
GITHUB_TOKEN: ${{ secrets.SYNC_TOKEN }} | |
run: | | |
cd wiki_dir | |
mv ../generated.md ./Regex-Workflow-Templates.md | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Action" | |
git add . | |
git diff-index --quiet HEAD -- || git commit -m "update template" | |
git push | |