chore(deps): update peter-evans/create-pull-request action to v7 #68
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: Template and release project | |
on: | |
push: | |
tags: | |
- "*" | |
pull_request: | |
workflow_dispatch: {} | |
env: | |
PRE_COMMIT_VERSION: "4.0.1" | |
jobs: | |
rendered-project: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
actions: write | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: generate-token | |
with: | |
app-id: ${{ secrets.IDP_TOOLKIT_APP_ID }} | |
private-key: ${{ secrets.IDP_TOOLKIT_APP_KEY }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Install boilerplate | |
run: curl -fsSL https://github.com/gruntwork-io/boilerplate/releases/latest/download/boilerplate_linux_amd64 -o /usr/local/bin/boilerplate && chmod +x /usr/local/bin/boilerplate | |
- name: Copy the current state for use with templating | |
run: cp -a project-template/ boilerplate-values.yml /tmp | |
- name: Checkout rendered project branch | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
ref: "rendered-project" | |
- name: Run boilerplate | |
run: boilerplate --non-interactive --template-url /tmp/project-template --output-folder . --var-file /tmp/boilerplate-values.yml | |
- name: Install helm-docs | |
run: curl -fsSL -o /tmp/hd.deb https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.deb && sudo dpkg -i /tmp/hd.deb && rm /tmp/hd.deb | |
- name: Replace source repo info | |
run: sed -i 's/org\.opencontainers\.image\.source=https:\/\/github\.com\/giantswarm\/demo-album-catalogpack/org\.opencontainers\.image\.source=https:\/\/github\.com\/giantswarm\/devplatform-template-go-service/' project.toml | |
- name: Install pipx | |
run: sudo apt-get install -y --no-install-recommends pipx | |
- name: Install pre-commit | |
run: pipx install pre-commit==${{ env.PRE_COMMIT_VERSION }} | |
- name: Cache pre-commit hooks | |
id: cache-pre-commit-hooks | |
uses: actions/cache@v4 | |
env: | |
cache-name: pre-commit-hooks | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-pre-commit-${{ env.PRE_COMMIT_VERSION }}-hooks-${{ hashFiles('.pre-commit-config.yaml') }} | |
- if: ${{ steps.cache-pre-commit-hooks.outputs.cache-hit != 'true' }} | |
name: Install pre-commit hooks | |
run: pre-commit install-hooks | |
- name: Run pre-commit | |
continue-on-error: true | |
run: | | |
pipx ensurepath | |
pre-commit run --show-diff-on-failure --color=always --all-files | |
- name: Commit rendered project | |
id: cpr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
branch: "rendered-project-${{ github.head_ref }}" | |
delete-branch: true | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Create comment when no change | |
if: ${{ !steps.cpr.outputs.pull-request-number }} | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.number }} | |
body: | | |
Your current PR doesn't make any change in the rendered project. No PR was created. | |
- name: Create comment when change | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
uses: peter-evans/create-or-update-comment@v4 | |
with: | |
issue-number: ${{ github.event.number }} | |
body: | | |
A Pull Request was created to preview the result of this PR. | |
Make sure you review and accept the created PR before you merge this one! | |
Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }} |