Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove continue-on-error from meto-repo action #261

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 19 additions & 28 deletions .github/actions/meta-repo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,45 +31,36 @@ runs:

- name: Checkout metadata repo (${{ inputs.META_REPO_BRANCH }})
uses: actions/checkout@v4
id: meta-branch-exists
continue-on-error: true
with:
repository: ${{ inputs.META_REPO }}
ref: ${{ inputs.META_REPO_BRANCH }}
token: ${{ env.GH_BOT_DEPLOY_TOKEN || github.token }}
fetch-depth: 1
path: ${{ steps.encode-meta-repo-branch.outputs.meta-repo-branch-b64 }}

- name: Checkout metadata repo (${{ inputs.META_REPO_BRANCH }})
uses: actions/checkout@v4
if: steps.meta-branch-exists.outcome != 'success'
with:
repository: ${{ inputs.META_REPO }}
ref: ${{ inputs.META_REPO_DEFAULT_BRANCH }}
token: ${{ env.GH_BOT_DEPLOY_TOKEN || github.token }}
fetch-depth: 1
path: ${{ steps.encode-meta-repo-branch.outputs.meta-repo-branch-b64 }}
clean: true

- name: Create remote branch (${{ inputs.META_REPO_BRANCH }})
if: steps.meta-branch-exists.outcome != 'success'
- name: Push data to metadata repo (${{ inputs.META_REPO_BRANCH }})
shell: bash
working-directory: ${{ steps.encode-meta-repo-branch.outputs.meta-repo-branch-b64 }}
run: |
git checkout -b ${{ inputs.META_REPO_BRANCH }}
git push --set-upstream origin ${{ inputs.META_REPO_BRANCH }}
git config user.email "[email protected]" || exit 1
git config user.name "GitHub Actions" || exit 1

- name: Push changes
shell: bash
working-directory: ${{ steps.encode-meta-repo-branch.outputs.meta-repo-branch-b64 }}
run: |
git config --global user.email "[email protected]" && \
git config --global user.name "github-actions"
git fetch --all

if git branch -a | grep -q "${{ inputs.META_REPO_BRANCH }}"; then
git checkout "${{ inputs.META_REPO_BRANCH }}" || exit 1
git pull origin "${{ inputs.META_REPO_BRANCH }}" || exit 1
else
git checkout -b "${{ inputs.META_REPO_BRANCH }}" || exit 1
fi

echo "${{ inputs.META_CONTENT }}" | tee metafile.txt
echo "${{ inputs.META_CONTENT }}" | tee metafile.txt || exit 1

git status --porcelain | grep -q . || exit 0
git add metafile.txt || exit 1

git add -v metafile.txt && \
git commit --branch -m "update metadata" && \
git push --atomic -v
if git status --porcelain | grep -q .; then
git commit -m "update metadata" || exit 1
git push --set-upstream origin "${{ inputs.META_REPO_BRANCH }}" --atomic -v || exit 1
else
echo "No changes to commit"
fi