I'm trying to pull a git submodule during my 'push' github action. The submodule is a private repository.
I've created a PAT with read-only access to my repositories. And I've added the contents of that PAT as a secret in the git repo (not the submodule).
This is my github action file:
name: Java CI
on: [ push ]
env:
SUBMODULE_ACCESS: ${{ secrets.SUBMODULE_ACCESS }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- name: Update submodules
run: |
git config --global url."https://${SUBMODULE_ACCESS}:x-oauth-basic#github.com/".insteadOf "https://github.com/"
git submodule update --init --recursive
- name: Set up JDK 19
uses: actions/setup-java#v2
with:
java-version: '19'
distribution: 'adopt'
- name: Cache local .m2
uses: actions/cache#v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**.pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run lints and test with Maven
run: mvn clean install -Dall
When I run this, I see the following error:
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
But that link just mentions PATs, which I think I've set up?
Related
I have a non-gradle root project which should launch child gh action, but can’t figure out how to. File child.yml should generate apk artifact, since android/ dir is app directory.
Project structure:
root
|
--- .github/workflows/root.yml
--- android/
|
___ .github/actions/apk/child.yml
Closest I get was running a yaml on root level:
root.yml
name: use my action
on:
push:
branches:
- ci_test
jobs:
#Build job
test_build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout#v2
- uses: ./android/.github/actions/apk
child.yml
name: Build of dev branch
on:
push:
branches:
- develop
jobs:
#Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout#v2
- uses: actions/cache#v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: Set up JDK 11
uses: actions/setup-java#v1
with:
java-version: '11'
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build the app
run: ./gradlew assembleDebug
- name: Upload apk
uses: actions/upload-artifact#v2
with:
name: debug apk
path: ./app/build/outputs/apk/debug/app-debug.apk
But I get an error with doubled "/my-root-dir/my-root-dir"
Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/my-root-dir/my-root-dir/android/.github/actions/child.yaml'. Did you forget to run actions/checkout before running your local action?
I am creating my first NPM packages and working on automating the publish using GitHub Actions. For each commit, I would like to increase the minor version automatically.
If I use npm version minor on the CLI and trigger the GitHub Action, the deployment is completed successfully.
If I try to run the command npm version minor as part of GitHub Action, the deployment is failing at npm publish step.
Workflow File
name: "publish"
on:
push:
branches:
- main
jobs:
release:
name: publish
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout#v3
- name: git configs
run: |
git config user.name nandy
git config user.email nandy#gmail.com
- name: node
uses: actions/setup-node#v3
with:
node-version: 16
registry-url: https://registry.npmjs.org
- run: npm version patch
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
Error Message
We're using changesets action to generate releases and publish to NPM. Here's an example:
Action Log
Release created by that run
The action that I want to run for each release is meant to upload some artifacts.
name: Bundle
on:
release:
types:
- created
- published
- prereleased
- released
jobs:
bundle:
# Prevents changesets action from creating a PR on forks
if: github.repository == 'patternfly/patternfly-elements'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- uses: actions/setup-node#v2
with:
node-version: 16
cache: npm
- name: Install packages
run: npm i --prefer-offline
- name: Dump GitHub Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Bundle
id: bundle
if: ${{ steps.changesets.outputs.published }}
uses: actions/github-script#v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const workspace = '${{ github.workspace }}';
const bundle = require('./scripts/bundle-release.cjs');
await bundle({ context, github, glob, workspace });
I expected this workflow to run immediately after the changesets publish run, but it did not. In fact it hasn't run once since being added to the repo.
What could be causing this issue?
Currently, I got some problems when I try to write the YAML file for deploying the GitHub action for KMM project. I don't know how to write the correct script (gradlew command) about testing the code of the shared module. Here's a part of my YAML file:
test_job:
name: Test
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout#v2
- name: Set up JDK 11
uses: actions/setup-java#v2
with:
java-version: '11'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action#e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Restore Cache
uses: actions/cache#v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Make gradle executable
run: chmod +x ./gradlew
- name: Run Debug Tests
run: ./gradlew testDebugUnitTest --continue
- name: Upload Test Reports
if: ${{ always() }}
uses: actions/upload-artifact#v2
with:
name: test-reports
path: '**/build/reports/tests/'
You can use:
./gradlew check to run tests for all your targets
./gradlew <targetName>Test to run it for a specific target
Note that probably you'd want to specify the shared module as well, for ex: ./gradlew :shared:check
For more information you could check out: https://kotlinlang.org/docs/mpp-run-tests.html#run-tests-for-one-or-more-targets
I'm trying to get my python project to update on Pypi automatically through a github workflow.
I've never done a github workflow (or any workflow). It doesn't seem to work.
It's this line: uses: action/checkout#main under the build-n-publish part.
It always fails and I get: Unable to resolve action action/checkout#main, repository not found.
and this happens no matter what I put in place of main whether it's v1, v2, master, etc...
I couldn't find anything online explaining it. What should I have in place of main?
for context the .yml file:
name: CI
on:
push:
branches:
- main
jobs:
build-n-publish:
name: build and publish pee to pypi
runs-on: macOS-latest
steps:
- uses: action/checkout#pee
with:
repository: ''
- name: Set up Python 3.6
uses: actions/setup-python#v1
with:
python-version: 3.6
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish#master
with:
password: ${{ secrets.pypi_password }}
repository_url: https://pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish#master
with:
password: ${{ secrets.pypi_password }}.