Skip to content
name: publish_community_operators
on:
workflow_call:
inputs:
community_repo:
type: boolean
required: true
org:
type: string
required: true
repo:
type: string
required: true
dir:
type: string
required: false
secrets:
GH_ROBOT_TOKEN:
required: true
jobs:
create-pull-request:
runs-on: ubuntu-latest
env:
GH_REF_NAME: vX.Y.Z # placeholder for testing
BRANCH_NAME_BASE: ${{ github.actor }}/datadog-operator
ACTIONS_RUNNER_DEBUG: true
steps:

Check failure on line 29 in .github/workflows/publish-community-operators-base.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish-community-operators-base.yml

Invalid workflow file

You have an error in your yaml syntax on line 29
- name: setup env
run: |
echo "VERSION=${GH_REF_NAME:1:5}" >> $GITHUB_ENV
echo "COMMUNITY_BRANCH_NAME=$BRANCH_NAME_BASE-$GH_REF_NAME" >> $GITHUB_ENV
echo "TARGET_GH_ORG=${{ inputs.org }}" >> $GITHUB_ENV
echo "TARGET_GH_REPO=${{ inputs.repo }}" >> $GITHUB_ENV
echo "BUNDLE_PATH=bundle" >> $GITHUB_ENV
if [[ "${{ !inputs.community_repo }}" ]]; then
if [[ "${{ inputs.repo }}" == "redhat-marketplace-operators" ]]; then
echo "BUNDLE_PATH=bundle-redhat-mp" >> $GITHUB_ENV
elif [[ "${{ inputs.repo }}" == "certified-operators" ]]; then
echo "BUNDLE_PATH=bundle-redhat" >> $GITHUB_ENV
fi
echo "${{ secrets.REDHAT_TOKEN }} >> ~/.redhat/auths.json"
# sudo apt-get -y update
# sudo apt-get -y install skopeo
fi
- name: validate env
run: |
echo "$VERSION"
echo "$COMMUNITY_BRANCH_NAME"
echo "$TARGET_GH_ORG"
echo "$TARGET_GH_REPO"
echo "$BUNDLE_PATH"
- name: sync fork
env:
GH_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
run: |
echo $PWD
git checkout -b $COMMUNITY_BRANCH_NAME
git push -f --set-upstream origin $COMMUNITY_BRANCH_NAME
gh repo sync DataDog/${{ inputs.repo }} --branch $COMMUNITY_BRANCH_NAME \
--source ${{ inputs.org }}/${{ inputs.repo }} \
--force
- name: checkout fork
uses: actions/checkout@v4
with:
repository: DataDog/${{ inputs.repo }}
token: ${{ secrets.GH_ROBOT_TOKEN }}
- name: checkout datadog-operator to tmp/ dir
uses: actions/checkout@v4
with:
repository: Datadog/datadog-operator
token: ${{secrets.GH_ROBOT_TOKEN}}
path: tmp/
- name: update bundle
run: |
echo $PWD
ls -la $PWD
mkdir operators/$OPERATOR_DIR/$VERSION
cp -R ./$BUNDLE_PATH/* operators/${{ inputs.dir }}/$VERSION
rm -rf ./tmp
- name: Configure git user
run: |
git config --global user.name ${{ github.actor }}
git config --global user.email ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
- name: create PR
env:
GH_TOKEN: ${{secrets.GH_ROBOT_TOKEN}}
run: |
message="operator datadog-operator ($VERSION)"
body="operator datadog-operator ($VERSION)"
git add -A
git commit -s -m "$message"
git push -f --set-upstream origin $COMMUNITY_BRANCH_NAME
gh pr create --title "$message" \
--body "$body" \
--repo DataDog/${{ inputs.repo }} \
--base main \
--draft