Skip to content

Commit

Permalink
Reverts to bare git calls
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Mar 3, 2024
1 parent 1884788 commit c757be8
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
# We need custom PAT through the whole job so we get workflow permissions to update all the boilerplate .github
# files from awesome-template.
steps:
- uses: actions/checkout@v4.1.1
- name: Initial checkout
uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }}
- name: Sync from template repo
Expand All @@ -31,20 +32,25 @@ jobs:
with:
github_token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }}
source_repo_path: kdeldycke/awesome-template
pr_title: "[sync] Updates from `awesome-template` repository"
pr_commit_msg: "[sync] Updates from `awesome-template` repository"
pr_title: "[sync] Updates from `awesome-template`"
pr_commit_msg: "[sync] Updates from `awesome-template`"
pr_branch_name_prefix: "sync-awesome-template"
pr_labels: "📚 documentation"

- name: Print PR branch ID
run: |
echo "PR branch ID: ${{ steps.template_sync.outputs.pr_branch }}"
- name: Checkout template sync PR
- name: Checkout new template sync branch
uses: actions/checkout@v4.1.1
with:
ref: ${{ steps.template_sync.outputs.pr_branch }}
token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }}
ref: ${{ steps.template_sync.outputs.pr_branch }}

# XXX We cannot rely on peter-evans/create-pull-request to manage the push of the new commit to the PR, as it
# ends up with a: "Unexpected error: fatal: could not open '.git/COMMIT_EDITMSG': Permission denied".
# See: https://github.com/AndreasAugustin/actions-template-sync/issues/484
# So we manage the next steps with bare git calls.

- name: List commits
run: |
Expand All @@ -60,20 +66,25 @@ jobs:
run: |
git diff
- uses: peter-evans/create-pull-request@v6.0.1
with:
token: ${{ secrets.WORKFLOW_UPDATE_GITHUB_PAT || secrets.GITHUB_TOKEN }}
assignees: ${{ github.actor }}
commit-message: "[sync] Updates from `awesome-template`"
title: "[sync] Updates from `awesome-template`"
body: >
<details><summary><code>Workflow metadata</code></summary>
- name: Setup Git user
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: Deactivate LFS
# XXX Was introduced in https://github.com/AndreasAugustin/actions-template-sync/commit/5335a55
run: |
git config lfs.https://github.com/kdeldycke/${{ github.event.repository.name }}.git/info/lfs.locksverify false
> [Auto-generated on run `#${{ github.run_id }}`](${{ github.event.repository.html_url }}/actions/runs/${{
github.run_id }}) by `${{ github.job }}` job from [`docs.yaml`](${{ github.event.repository.html_url
}}/blob/${{ github.sha }}/.github/workflows/docs.yaml) workflow.
- name: Create commit
run: |
git commit --all --message'Update template URLs with local ones'
- name: Squash commits
run: |

Check failure on line 84 in .github/workflows/docs.yaml

View workflow job for this annotation

GitHub Actions / lint / lint-github-action

shellcheck reported issue in this script: SC2046:warning:1:18: Quote this to prevent word splitting

Check failure on line 84 in .github/workflows/docs.yaml

View workflow job for this annotation

GitHub Actions / lint / lint-github-action

shellcheck reported issue in this script: SC2006:style:2:43: Use $(...) notation instead of legacy backticks `...`
git reset --soft $(git merge-base main HEAD)
git commit --message "[sync] Updates from `awesome-template`"
</details>
branch: ${{ needs.awesome-template-sync.outputs.pr_branch }}
- name: Push commit to PR
run: |
git push --force

0 comments on commit c757be8

Please sign in to comment.