|
| 1 | +name: Publish wiki |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - 'main' |
| 6 | + paths: |
| 7 | + - wiki/** |
| 8 | + - .github/workflows/publish-wiki.yml |
| 9 | + # Do a dry-run (check, no deploy) for PRs. |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - wiki/** |
| 13 | + - .github/workflows/publish-wiki.yml |
| 14 | + # Allow running this workflow manually from the Actions tab. |
| 15 | + workflow_dispatch: |
| 16 | + # Allow this workflow to be triggered from outside. |
| 17 | + |
| 18 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 19 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 20 | +concurrency: |
| 21 | + group: "publish-wiki" |
| 22 | + cancel-in-progress: false |
| 23 | + |
| 24 | +jobs: |
| 25 | + publish-wiki: |
| 26 | + name: "Publish Wiki" |
| 27 | + if: github.repository == 'PHPCSStandards/PHP_CodeSniffer-documentation' |
| 28 | + |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + permissions: |
| 32 | + # Needed for the commit to the wiki. |
| 33 | + contents: write |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout code |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Copy wiki files to temporary location |
| 40 | + shell: bash |
| 41 | + run: cp -v -a wiki _wiki |
| 42 | + |
| 43 | + - name: Preface markdown files with warning not to edit in place |
| 44 | + shell: bash |
| 45 | + # yamllint disable rule:line-length |
| 46 | + # shellcheck disable=SC2016 |
| 47 | + run: > |
| 48 | + find ./_wiki/ -name "*.md*" |
| 49 | + -exec sed -i |
| 50 | + '1i\<!--\nWARNING: DO NOT EDIT THIS FILE IN THE WIKI.\nThis wiki is updated from the https://github.com/PHPCSStandards/PHP_CodeSniffer-documentation repository.\nSubmit a PR to that repository updating the relevant file in the /wiki/ subdirectory instead.\n-->\n' {} \; |
| 51 | + # yamllint enable rule:line-length |
| 52 | +
|
| 53 | + - name: Check GitHub Git Operations status |
| 54 | + uses: crazy-max/ghaction-github-status@v4 |
| 55 | + with: |
| 56 | + git_threshold: partial_outage |
| 57 | + |
| 58 | + - name: Deploy to wiki |
| 59 | + uses: Andrew-Chen-Wang/[email protected] |
| 60 | + env: |
| 61 | + COMMIT_MSG: ${{ github.event.head_commit.message }} |
| 62 | + with: |
| 63 | + strategy: 'clone' |
| 64 | + path: '_wiki/' |
| 65 | + commit-message: ${{ env.COMMIT_MSG }} |
| 66 | + repository: PHPCSStandards/PHP_CodeSniffer |
| 67 | + token: ${{ secrets.PHPCS_PUSH_TO_WIKI_TOKEN }} |
| 68 | + dry-run: ${{ github.event_name == 'pull_request' }} |
| 69 | + disable-empty-commits: true |
| 70 | + preprocess: false |
0 commit comments