|
5 | 5 | branches:
|
6 | 6 | - main
|
7 | 7 | - develop
|
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + - develop |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: write |
8 | 15 |
|
9 | 16 | jobs:
|
10 | 17 | update-header:
|
11 | 18 | runs-on: ubuntu-latest
|
12 | 19 |
|
13 | 20 | steps:
|
14 |
| - - name: Checkout repository |
15 |
| - uses: actions/checkout@v2 |
16 |
| - |
17 |
| - - name: Determine current branch |
18 |
| - id: vars |
19 |
| - run: echo "::set-output name=branch::$(git rev-parse --abbrev-ref HEAD)" |
20 |
| - |
21 |
| - - name: Update script header for main branch |
22 |
| - if: steps.vars.outputs.branch == 'main' |
23 |
| - run: | |
24 |
| - script_file="dist/BlockWebsites.js" |
25 |
| - sed -i 's/Block Websites - Development Version/Block Websites/' "$script_file" |
26 |
| - sed -i 's/\/develop\//\/main\//g' "$script_file" |
27 |
| -
|
28 |
| - - name: Update script header for develop branch |
29 |
| - if: steps.vars.outputs.branch == 'develop' |
30 |
| - run: | |
31 |
| - script_file="dist/BlockWebsites.js" |
32 |
| - sed -i 's/Block Websites/Block Websites - Development Version/' "$script_file" |
33 |
| - sed -i 's/\/main\//\/develop\//g' "$script_file" |
34 |
| -
|
35 |
| - - name: Commit and push changes |
36 |
| - run: | |
37 |
| - git config --global user.name 'github-actions[bot]' |
38 |
| - git config --global user.email 'github-actions[bot]@users.noreply.github.com' |
39 |
| - git add dist/BlockWebsites.js |
40 |
| - git commit -m "Update script header for ${{ steps.vars.outputs.branch }} branch" |
41 |
| - git push |
42 |
| - if: steps.vars.outputs.branch == 'main' || steps.vars.outputs.branch == 'develop' |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v2 |
| 23 | + |
| 24 | + - name: Determine current branch |
| 25 | + id: vars |
| 26 | + run: echo "::set-output name=branch::$(git rev-parse --abbrev-ref HEAD)" |
| 27 | + |
| 28 | + - name: Update script header for main branch |
| 29 | + if: steps.vars.outputs.branch == 'main' |
| 30 | + run: | |
| 31 | + script_file="dist/BlockWebsites.js" |
| 32 | + sed -i 's/Block Websites - Development Version/Block Websites/' "$script_file" |
| 33 | + sed -i 's/\/develop\//\/main\//g' "$script_file" |
| 34 | +
|
| 35 | + - name: Update script header for develop branch |
| 36 | + if: steps.vars.outputs.branch == 'develop' |
| 37 | + run: | |
| 38 | + script_file="dist/BlockWebsites.js" |
| 39 | + sed -i 's/Block Websites/Block Websites - Development Version/' "$script_file" |
| 40 | + sed -i 's/\/main\//\/develop\//g' "$script_file" |
| 41 | +
|
| 42 | + - name: Commit and push changes |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + run: | |
| 46 | + git config --global user.name 'github-actions[bot]' |
| 47 | + git config --global user.email 'github-actions[bot]@users.noreply.github.com' |
| 48 | + git add dist/BlockWebsites.js |
| 49 | + git commit -m "Update script header for ${{ steps.vars.outputs.branch }} branch" |
| 50 | + git push |
| 51 | + if: steps.vars.outputs.branch == 'main' || steps.vars.outputs.branch == 'develop' |
0 commit comments